Main node updating method and device, electronic equipment and storage medium
By selecting a new master node every N cycles in the smart AI glasses network and utilizing a preset order and node characteristic information, the problem of unstable communication quality caused by master node selection is solved, achieving more efficient communication and battery life management.
Patent Information
- Application Number
- CN202511400856.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-28
- Publication Date
- 2025-12-26
AI Technical Summary
The data transmission and communication quality between existing smart AI glasses is limited by the selection of the master node, resulting in unstable communication quality.
Every N cycles, a new master node is actively selected. The new master node is determined by factors such as preset order, power consumption, signal strength, and voice data packet transmission trend, ensuring the updating and replacement of nodes in the communication network.
It improves the update efficiency and communication quality of the master node, balances battery life and load balancing, and ensures communication stability.
Smart Images

Figure CN121218221A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, and more specifically, to a master node update method, apparatus, electronic device, and storage medium. Background Technology
[0002] With technological advancements, wearable devices such as smart AI (Artificial Intelligence) glasses have become widely used. Data transmission between different smart AI glasses typically involves selecting one smart AI glasses as the master node and the others as slave nodes. Slave nodes send data to the master node, which then forwards the data. However, the communication quality in this method is limited by the choice of master node. Summary of the Invention
[0003] This application provides a master node update method, apparatus, electronic device, and storage medium to improve the communication quality between the master node and the slave node.
[0004] In a first aspect, this application provides a master node update method, applied to a master node in a communication network. The method includes: establishing a connection with a slave node and transmitting data; after performing N cycles of data transmission, selecting a new master node so that the new master node establishes a connection with other nodes in the communication network.
[0005] In this embodiment, a new master node is actively selected after every N cycles of data transmission, thus preventing the continuous use of a single master node for communication. This avoids situations where poor communication quality is consistently caused by issues with a single master node.
[0006] In conjunction with the technical solution provided in the first aspect above, in some possible implementations, selecting a new master node includes: according to a preset master node update order, taking the node following the current master node in the master node update order as the new master node.
[0007] In this embodiment of the application, the update efficiency of the master node can be improved by replacing the master node in a preset order.
[0008] In conjunction with the technical solution provided in the first aspect above, in some possible implementations, selecting a new master node includes: obtaining the current power level and signal strength of each node; and determining a new master node based on the current power level and signal strength of each node.
[0009] In this embodiment, the new master node is determined by the current battery level and signal strength of each node, thus taking into account both battery life and communication quality.
[0010] In conjunction with the technical solution provided in the first aspect above, in some possible implementations, selecting a new master node includes: obtaining the voice data packet transmission trend of each node in the previous N periods; obtaining the current signal strength, current battery level, and idle load of each node; and determining a new master node based on the voice data packet transmission trend of each node in the previous N periods, as well as the current signal strength, current battery level, and idle load of each node.
[0011] In this embodiment, the more frequently a node sends voice data packets, the more data acquisition tasks that node needs to perform. Consequently, this node tends to consume more power and be subject to a higher load. Therefore, by analyzing each node's signal strength, current battery level, idle load, and voice data packet sending trends, a new master node can be determined from multiple dimensions such as communication quality, battery life, and load, thereby improving the quality of the ultimately determined master node.
[0012] In conjunction with the technical solution provided in the first aspect above, in some possible implementations, selecting a new master node includes: if no voice data packets are sent within N cycles, and each node sends keep-alive information, then a new master node is selected based on the signal strength and current battery level of each node; if a node sends voice data packets within N cycles, then data transmission continues for (M-1)×N cycles, and the voice data packet sending trend of each node is obtained based on the voice data packets sent by each node within these M×N cycles, and a new master node is determined based on the voice data packet sending trend, signal strength, current battery level, and idle load of each node.
[0013] In this embodiment, if no voice data packets are present within N cycles, it indicates that the data acquisition task for each node is relatively small within these N cycles. Therefore, there is no need to use the voice data packet transmission trend as a selection factor for the new master node, thereby reducing the computational load for master node selection. However, if voice data packets are present within N cycles, data transmission continues for (M-1)×N cycles to more accurately determine the voice data packet transmission trend of each node, thereby improving the accuracy of subsequent master node selection.
[0014] In conjunction with the technical solution provided in the first aspect above, in some possible implementations, a new master node is determined based on the voice data packet transmission trend, signal strength, current battery level, and idle load of each node, including: determining a node that meets a first condition as the new master node; the first condition is: the current battery level is the highest, and the idle load is greater than or equal to a preset first load threshold; if no node meets the first condition, a node that meets a second condition is designated as the new master node; the second condition is: the current battery level is greater than or equal to a preset battery threshold, the idle load is greater than or equal to a preset second load threshold, and the signal strength is greater than a preset signal strength threshold; the first load threshold is greater than the second load threshold; if no node meets the second condition, a node that meets a third condition is designated as the new master node; the third condition is: the voice data packet transmission trend indicates that voice data packets are being transmitted less and less.
[0015] In conjunction with the technical solution provided in the first aspect above, in some possible implementations, establishing a connection with a slave node includes: sending a beacon packet, the beacon packet including a timestamp, a MAC address, and an index of the paired slave node; enabling other nodes to establish a connection with the master node based on the beacon packet, and returning their own MAC addresses; saving the MAC addresses returned by the slave nodes, and sending the MAC addresses and node numbers of all slave nodes that have established connections with the master node to all slave nodes.
[0016] In this embodiment, by sending the MAC address and node number of all slave nodes that have established a connection with it to all slave nodes, it is possible for other slave nodes to quickly establish connections with other nodes based on the MAC address and node number of other nodes after being selected as the master node.
[0017] In conjunction with the technical solution provided in the first aspect above, in some possible implementations, after a preset time interval following the sending of the beacon packet, the time window corresponding to the slave node is entered.
[0018] In this embodiment, a buffer time for data collection is provided to the slave node by means of a preset time interval.
[0019] Secondly, this application provides a master node update method, applied to any slave node in a communication network. The method includes: establishing a connection with the master node and transmitting data; after executing N cycles of data transmission, sending its own characteristic information to the current master node so that the master node selects a new master node based on the characteristic information of each node; if the current node is selected as the new master node, sending a beacon packet in the time window corresponding to the current node in the next cycle to establish a connection with other nodes.
[0020] Thirdly, this application provides a master node update device deployed on a master node in a communication network. The device includes: a first transmission module for establishing a connection with a slave node and transmitting data; and a selection module for selecting a new master node after performing N cycles of data transmission, so that the new master node can establish a connection with other nodes in the communication network.
[0021] Fourthly, this application provides a master node update device, deployed on any slave node in a communication network. The device includes: a second transmission module, used to establish a connection with the master node and perform data transmission; the second transmission module is further used to send its own characteristic information to the current master node after performing N cycles of data transmission, so that the master node selects a new master node based on the characteristic information of each node; the second transmission module is further used to, if the node is selected as the new master node, send a beacon packet in the time window corresponding to the node in the next cycle to establish a connection with other nodes.
[0022] Fifthly, this application provides an electronic device, comprising: a memory, a processor, and a data transmission unit, wherein the memory and the processor are connected, and the data transmission unit is connected to the processor; the memory is used to store a program; the processor is used to invoke the program stored in the memory and control the data transmission unit to execute the method described in the first aspect and / or in combination with any possible implementation of the first aspect, or to execute the method described in the second aspect.
[0023] In a sixth aspect, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a computer, performs the method described in the first aspect and / or in combination with any possible implementation of the first aspect, or performs the method described in the second aspect. Attached Figure Description
[0024] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0025] Figure 1 This is a flowchart illustrating a master node update method applied to a master node according to an embodiment of this application; Figure 2 This is a timing diagram illustrating the data acquisition and transmission process in an embodiment of this application. Figure 3This is a flowchart illustrating a master node update method applied to a slave node, as shown in an embodiment of this application. Figure 4 This is a structural block diagram of a master node update device shown in an embodiment of this application; Figure 5 This is a structural block diagram of an electronic device shown in an embodiment of this application. Detailed Implementation
[0026] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.
[0027] It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. Furthermore, relational terms such as "first," "second," etc., in the description of this application are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus.
[0028] The technical solution of this application will now be described in detail with reference to the accompanying drawings.
[0029] Please see Figure 1 , Figure 1 This is a flowchart illustrating a master node update method applied to a master node in a communication network, as shown in an embodiment of this application. The following will be combined with... Figure 1 The steps involved are explained.
[0030] S110: Establish a connection with the slave node and perform data transmission.
[0031] Optionally, the master node and slave node can transmit data via WiFi, Bluetooth, LAN, etc., and there are no restrictions on the specific method used here.
[0032] The specific methods for establishing a connection between the master node and the slave node are well known to those skilled in the art, and will not be elaborated here for the sake of brevity.
[0033] Optionally, the connection between the master node and the slave node can be established as follows: First, both the master node and the slave node (not yet connected) enable SoftAP (Software-Simulated Access Point, a technology that uses software to turn Wi-Fi-enabled devices (such as smartphones and laptops) into wireless hotspots). In this case, each data transmission cycle is divided into multiple time windows. For example, if the maximum number of nodes is set to 5 (i.e., a maximum of 1 master node and 4 slave nodes), the time windows can be divided into five windows: master_slot0, dev_slot1, dev_slot2, dev_slot3, and dev_slot4, with each data transmission cycle lasting 10ms.
[0034] The master node sends a beacon packet within its corresponding time window. The beacon packet includes a timestamp, MAC address, and the index of the paired slave node; this allows other nodes to establish connections with the master node based on the beacon packet and returns their own MAC address. The timestamp represents the time window information, indicating the time window corresponding to each node, as well as the idle time window. The index of the paired slave node is also the slave node's device information number; different nodes have different device information numbers.
[0035] After receiving the beacon packet, the slave node performs timestamp synchronization based on the information in the beacon packet, saves the master node's MAC address, marks the master device, determines its own corresponding device information number, and saves its own corresponding time window (including start time and time window length).
[0036] In the next cycle, the slave node sends an acknowledgment message and its corresponding MAC address within its own time window. The acknowledgment message confirms that a connection has been established between the slave node and the master node.
[0037] The master node stores the MAC addresses returned by the slave nodes and sends the MAC addresses and node numbers of all slave nodes that have established connections with it to all slave nodes. This completes the pairing of the master and slave nodes, establishing a connection between them.
[0038] The node number is the same as the device information number mentioned above. Each node has a unique node number, and each node number also has a unique node.
[0039] Optionally, the beacon package may include fields indicating whether each node is online, whether each node is a master node, the MAC address of each node, and the time window corresponding to each node.
[0040] For example, the information included in the beacon package can be shown in Table 1.
[0041] Table 1
[0042] As shown in Table 1, the 2ms window indicates that the length of each window is 2ms. Rows containing the window's MAC address, index, online status, and empty master device indicate that the window has not yet been assigned to a slave node.
[0043] Optionally, after selecting a new master node in S120, all parameters shown in Table 1, except for the master control device parameter which will change (the master control device parameter for the new master node will change to "yes", while the master control device parameter for the original master node will change to "no"), do not need to be changed.
[0044] In one implementation, when the master node and slave nodes transmit data, each node can only send data within its own corresponding time window. Slave nodes can receive data packets sent by the master node within the master node's time window. The master node can receive data packets sent by any corresponding slave node within any slave node's time window.
[0045] Optionally, each node may send a keep-alive message if it does not have any data to send within its corresponding time window. The keep-alive message indicates that the current node is connected and has not lost connection.
[0046] If the master node does not receive any information from the slave node for M consecutive cycles, it indicates that the slave node has gone offline. Conversely, if the slave node does not receive any information from the master node for M consecutive cycles, it indicates that the master node has gone offline. Here, M is a positive integer.
[0047] Optionally, if a slave node goes offline, the master node will mark the corresponding slave node as offline.
[0048] Optionally, if the master node goes offline, select one of the remaining slave nodes as the new master node.
[0049] In one implementation, if the data transmission between the master node and the slave node is for transmitting audio data for voice chat, then when either node needs to send audio data for voice chat, human voice detection is performed on the collected audio data. If it is determined that the collected audio data includes human voice, the collected audio data is sent. If it is determined that the collected audio data does not include human voice, a keep-alive message is sent.
[0050] The method for human voice detection can be any existing method that can detect human voices in audio data. For example, it can be detection using a neural network model or VAD (Voice Activity Detection). The method for human voice detection is not limited to the method exemplified here.
[0051] In one implementation, after the master node sends the beacon packet, it enters the corresponding time window of the slave node after a preset time interval. By using the preset time interval, sufficient time is provided for the slave node to collect voice data.
[0052] The preset interval time can be set according to actual needs, such as n communication cycles, where n is a positive integer; or the duration can be set directly, such as 10ms, 20ms, 30ms, 40ms, etc.
[0053] In one implementation, audio data is transmitted between the master node and the slave node to enable voice calls.
[0054] In this scenario, during data transmission between the master and slave nodes, each cycle is divided into N time windows, where N is greater than or equal to the number of nodes (including all slave and master nodes). Each node continuously collects data, and each node only transmits data within its corresponding time window, with each transmitted audio data segment being the length of one cycle.
[0055] For example, audio data collected by a node between the start of the previous time window and the start of the next clock window can be transmitted in the next clock window.
[0056] For easier understanding, please refer to Figure 2 . Figure 2 The following example illustrates the concept of 5 nodes, with each node having a 2ms time window.
[0057] like Figure 2 As shown, time window T1 is the time window corresponding to node 1, time window T2 is the time window corresponding to node 2, time window T3 is the time window corresponding to node 3, time window T4 is the time window corresponding to node 4, and time window T5 is the time window corresponding to node 5.
[0058] Figure 2 This shows the relationship between data collection and data transmission at node 1, as follows: Figure 2 As shown, the audio data collected by node 1 in the black area is transmitted in the subsequent time window T1. While node 1 is transmitting data in window T1, it will synchronously collect the next data to be transmitted.
[0059] The data sent by each node within its corresponding time window is the audio data collected 10ms (one cycle) before that time window. The implementation of other nodes is the same as that of node 1, and will not be elaborated here for the sake of brevity.
[0060] The examples provided are for illustrative purposes only and should not be construed as limiting the scope of this application.
[0061] Optionally, after the audio data is collected, human voice detection can be performed on the collected audio data. The collected audio data is only sent if human voice is detected in the collected audio data. Otherwise, a keep-alive message is sent.
[0062] Optionally, if the data acquisition duration is 10ms, the resolution is 16bit, the sampling rate is 48K, and the audio data is acquired in mono mode, then each data transmission will be 960 bytes. Without compression, according to the configuration of wifi4 mcs, the transmission time will be as slow as 1.18ms. Therefore, each time window can be set to be greater than or equal to 1.18ms.
[0063] S120: After performing N cycles of data transmission, a new master node is selected so that the new master node can establish a connection with other nodes in the communication network.
[0064] Where N is a positive integer greater than 1. The specific value of N can be set according to actual needs, such as 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, etc. The specific value of N is not limited to the values given in the examples here.
[0065] In one implementation, a new master node can be selected by: following a preset master node update order, selecting the node following the current master node as the new master node.
[0066] The preset master node update order refers to sorting all nodes in the communication network (including the initial master node) and then appointing them as new master nodes in sequence. After the last node in the preset master node update order becomes the new master node, the cycle restarts from the first node in the same order.
[0067] For example, if N is 100, the communication network includes four nodes: node A, node B, node C, and node D, and the preset master node update order is node A, node B, node C, and node D.
[0068] When establishing a connection in a communication network, if node A is the master node, then after 100 cycles, node B is selected as the new master node according to the preset master node update order. This enables node B to establish connections and communicate with nodes A, C, and D.
[0069] After 100 cycles of communication with node B as the master node, node C is selected as the new master node, followed by node D, node A, node B, and so on.
[0070] Optionally, if a node following the current master node becomes disconnected, the nearest node that is not disconnected after the current master node is selected as the master node.
[0071] For example, the preset master node update order is node A, node B, node C, and node D. If the current master node is node A, while node B is disconnected and node C is connected, then node C will be selected as the next master node.
[0072] If both nodes B and C are disconnected, then node D will be selected as the next master node.
[0073] The examples provided are for illustrative purposes only and should not be construed as limiting the scope of this application.
[0074] Optionally, if a node becomes disconnected, that disconnected node is removed from the master node update order, resulting in an updated master node update order. The new master node is then determined based on this updated master node update order.
[0075] For example, the preset master node update order is node A, node B, node C, and node D. If node B is disconnected, then node B is removed from the master node update order, and the updated master node update order becomes node A, node C, and node D. This example is for illustrative purposes only and should not be construed as a limitation of this application.
[0076] Optionally, if a new node joins during communication, it can be added to the master node update order to obtain an updated master node update order. The new master node is then determined based on this updated master node update order.
[0077] The specific position of a newly added node in the master node update order can be set according to actual needs. For example, it can be placed at the very end, the very beginning, or the middle of the master node update order. There are no restrictions on its specific position here.
[0078] In one implementation, the new master node can be selected by first obtaining the current battery level and signal strength of each node. Then, based on the current battery level and signal strength of each node, a new master node is determined.
[0079] Optionally, the current battery level and signal strength of each node can be sent to the master node by each slave node during the Nth cycle.
[0080] Alternatively, the current battery level and signal strength of each node can be carried in the data packet (voice data packet or keep-alive information) each time it sends data to the master node.
[0081] Optionally, based on the current battery level and signal strength of each node, the new master node can be determined by selecting the node with the highest current battery level and the strongest signal strength from all nodes.
[0082] Alternatively, the new master node can be determined based on the current battery level and signal strength of each node by identifying all nodes whose current battery level is greater than a preset battery level threshold and whose signal strength is greater than a preset signal strength threshold. Then, one node is randomly selected from these identified nodes as the new master node.
[0083] Alternatively, based on the current battery level and signal strength of each node, the new master node can be determined by identifying all nodes whose current battery level is greater than a preset battery threshold, and then selecting the node with the strongest signal strength from among all identified nodes as the new master node.
[0084] Alternatively, based on the current battery level and signal strength of each node, the new master node can be determined by identifying all nodes whose signal strength is greater than a preset signal strength threshold, and then selecting the node with the highest current battery level from among all identified nodes as the new master node.
[0085] The current battery level can refer to the node's remaining battery power. Alternatively, the current battery level can also be interpreted as the duration for which the node's remaining battery power can sustain its operation.
[0086] Signal strength can be the RSSI (Received Signal Strength) of each node, or it can be other parameters that can represent the signal quality of a node.
[0087] The preset power threshold and preset signal strength threshold mentioned above can be set according to actual needs, and their specific values are not limited here.
[0088] In one implementation, the selection of a new master node can also be achieved by: obtaining the voice data packet transmission trend of each node over the previous N periods; then obtaining the current signal strength, current battery level, and idle load of each node; and finally determining a new master node based on the voice data packet transmission trend of each node over the previous N periods, as well as the current signal strength, current battery level, and idle load of each node.
[0089] The voice data packet transmission trend of each node refers to the distribution pattern of voice data packets transmitted by each node in the first N periods.
[0090] Optionally, the voice data packet transmission trend of each node can be calculated as follows: For each node, calculate the number of cycles between two adjacent voice data packets transmitted by that node to obtain a cycle number sequence. Then, use a descending order algorithm, linear regression algorithm, etc., to calculate the slope of the cycle number sequence to obtain the voice data packet transmission trend corresponding to that node.
[0091] Alternatively, the voice data packet transmission trend for each node can be calculated as follows: Divide the N periods evenly into X period segments, each containing Y periods, i.e., X × Y = N, where X and Y are both positive integers. Then, for each node, count the number of voice data packets transmitted in each period segment to obtain a sequence of voice data packet transmission counts (including the transmission counts of Y voice data packets, sorted chronologically). Finally, use descending order algorithms, linear regression algorithms, etc., to calculate the slope of the voice data packet transmission count, thus obtaining the voice data packet transmission trend for that node. A smaller slope indicates a decreasing trend in voice data packet transmission over the N periods.
[0092] Alternatively, the voice data packet transmission trend for each node can be calculated as follows: Divide the N periods evenly into X period segments, each segment containing Y periods, i.e., X × Y = N, where X and Y are both positive integers. Then, for each node, count the number of keep-alive messages transmitted in each period segment to obtain a keep-alive message transmission sequence (including the number of Y keep-alive messages, sorted chronologically). Finally, use descending order algorithms, linear regression algorithms, etc., to calculate the slope of the keep-alive message transmission count, thus obtaining the voice data packet transmission trend for that node. A larger slope indicates a decreasing trend in voice data packet transmission over the N periods.
[0093] Idle load represents the unused resources of a node, which can be the ratio of a node's idle time to its load time, etc. The specific implementation methods for a node's signal strength and current battery level have been clearly described above and will not be repeated here for the sake of brevity.
[0094] Optionally, based on the voice data packet transmission trend of each node in the previous N periods, and the current signal strength, current battery level, and idle load of each node, the new master node can be determined by selecting the node that meets the first condition as the new master node. The first condition is: the current battery level is the highest, and the idle load is greater than or equal to a preset first load threshold.
[0095] If no node meets the first condition, the node that meets the second condition will be designated as the new master node. The second condition is: current battery level is greater than or equal to a preset battery level threshold, idle load is greater than or equal to a preset second load threshold, signal strength is greater than a preset signal strength threshold, and the first load threshold is greater than the second load threshold.
[0096] If no node satisfies the second condition, the node that satisfies the third condition will be designated as the new master node. The third condition is: the voice data packet sending trend indicates that fewer and fewer voice data packets are being sent.
[0097] The specific values of the preset first load threshold, preset power threshold, and preset signal strength threshold can be set according to actual needs, and their specific values are not restricted here.
[0098] Alternatively, based on the voice data packet transmission trend of each node in the previous N periods, as well as the current signal strength, current battery level, and idle load of each node, the new master node can also be determined by selecting the node that meets the second condition as the new master node. The second condition is: the current battery level is greater than or equal to a preset battery threshold, the idle load is greater than or equal to a preset second load threshold, the signal strength is greater than a preset signal strength threshold, and the first load threshold is greater than the second load threshold.
[0099] If no node meets the second condition, the node that meets the first condition will be designated as the new master node. The first condition is: the current battery level is the highest, and the idle load is greater than or equal to a preset first load threshold.
[0100] If no node satisfies the first condition, the node satisfying the third condition will be designated as the new master node. The third condition is: the trend of voice data packet transmission indicates that fewer and fewer voice data packets are being transmitted.
[0101] Alternatively, the new master node can be determined based on the voice data packet transmission trend of each node in the previous N periods, as well as the current signal strength, current battery level, and idle load of each node. The node that meets the first condition is selected as the new master node. The first condition is: the current power is the highest, and the idle load is greater than or equal to the preset first load threshold.
[0102] If multiple nodes meet the first condition, then the node that meets the second condition is selected from these multiple nodes as the new master node. The second condition is: the current battery level is greater than or equal to a preset battery level threshold, the idle load is greater than or equal to a preset second load threshold, the signal strength is greater than a preset signal strength threshold, and the first load threshold is greater than the second load threshold.
[0103] If multiple nodes simultaneously satisfy both the first and second conditions, then from among these nodes, the node that satisfies the third condition is determined as the new master node. The third condition is: the voice data packet sending trend indicates that voice data packets are being sent less and less.
[0104] If there are multiple nodes that satisfy the first, second, and third conditions, then a node that satisfies the first, second, and third conditions is randomly selected as the new master node.
[0105] Based on the voice data packet transmission trend of each node in the previous N periods, as well as the current signal strength, current power, and idle load of each node, the method for determining the new master node is not limited to the methods exemplified above. Any method that uses the current signal strength, current power, and idle load of each node to determine the new master node should fall within the scope of protection required by this scheme.
[0106] In one implementation, the method for selecting a new master node can also be as follows: if there are no voice data packets within N cycles and each node sends keep-alive information, then a new master node is selected based on the signal strength and current battery level of each node.
[0107] If a node sends voice data packets within N cycles, then data transmission continues for (M-1)×N cycles. Based on the voice data packets sent by each node within these M×N cycles, the voice data packet sending trend of each node is obtained. Based on the voice data packet sending trend, signal strength, current battery level, and idle load of each node, a new master node is determined.
[0108] The method for selecting a new master node based on the signal strength and current power of each node has been clearly described above and will not be repeated here for the sake of brevity.
[0109] The specific implementation method of obtaining the voice data packet transmission trend of each node based on the voice data packets sent by each node within the M×N cycles is consistent with the aforementioned method of dividing the N cycles evenly into X cycle segments, with each cycle segment including Y cycles, and then determining the voice data packet transmission trend corresponding to the N cycles. For the sake of brevity, it will not be elaborated here.
[0110] The method for determining a new master node based on the voice data packet transmission trend, signal strength, current battery level, and idle load of each node has been clearly described above and will not be repeated here for the sake of brevity.
[0111] In one implementation, when a new master node establishes a connection with other nodes, the new master node sends a beacon packet. Upon receiving the beacon packet, other nodes update their own master node identifiers and send their MAC address and acknowledgment information to the new master node.
[0112] To facilitate understanding of the master node update method described above, examples will be provided below.
[0113] First, both the master and slave nodes enable softap. At this point, each data transmission cycle is divided into five time windows: master_slot0, dev_slot1, dev_slot2, dev_slot3, and dev_slot4. Each data transmission cycle is 10ms, meaning the sum of these five time windows is 10ms.
[0114] The master node sends a beacon packet within its corresponding time window. This allows other nodes to establish connections with the master node based on the beacon packet and return their own MAC address.
[0115] After receiving the beacon packet, the slave node performs timestamp synchronization based on the information in the beacon packet, saves the master node's MAC address, marks the master device, determines its own corresponding device information number, and saves its own corresponding time window (including start time and time window length).
[0116] In the next cycle, the slave node sends an acknowledgment message and its corresponding MAC address within its own time window. The acknowledgment message confirms that a connection has been established between the slave node and the master node.
[0117] The master node stores the MAC addresses returned by the slave nodes and sends the MAC addresses and node numbers of all slave nodes that have established connections with it to all slave nodes. This completes the pairing of the master and slave nodes, establishing a connection between them.
[0118] The master node determines whether any nodes have gone offline based on the data packets it receives from the slave nodes. If a node has gone offline, the master node updates the status of the offline node and synchronizes this information with the other slave nodes.
[0119] After 100 communication cycles between the master node and the slave node, the master node determines whether there are voice data packets based on the data packets it receives from the slave node.
[0120] If no voice data packets are transmitted within 100 cycles and each node sends keep-alive information, a new master node is selected based on the signal strength and current battery level of each node.
[0121] If a node sends voice data packets within 100 cycles, data transmission continues for another 400 cycles. Based on the voice data packets sent by each node within these 500 cycles, the voice data packet sending trend for each node is obtained. Based on the voice data packet sending trend, signal strength, current battery level, and idle load of each node, a new master node is determined.
[0122] After the new master node is determined, the slave nodes update the marked master node and send data to the new master node in the next cycle (that is, use the new master node's MAC address as the new sending address).
[0123] Repeat the above process to update the master node until communication stops.
[0124] Based on the same technical concept, this application also provides a method for updating the master node of any slave node in a communication network. The following will combine... Figure 3 The steps involved are explained.
[0125] S210: Establish a connection with the master node and perform data transmission.
[0126] The specific methods for establishing a connection between a slave node and a master node have been clearly described above, and will not be repeated here for the sake of brevity.
[0127] S220: After performing N cycles of data transmission, it sends its own characteristic information to the current master node so that the master node can select a new master node based on the characteristic information of each node.
[0128] In one implementation, the characteristic information of the slave node may include signal strength and current battery level.
[0129] Optionally, the characteristic information of the slave node can also be used to monitor the idle load.
[0130] S230: If this node is selected as the new master node, it will send a beacon packet in the time window corresponding to this node in the next cycle to establish a connection with other nodes.
[0131] The specific method by which the slave node selected as the new master node executes S230 has been clearly described above, and will not be repeated here for the sake of brevity.
[0132] Based on the same technical concept, this application also provides a master node update device deployed in a communication network, such as... Figure 4As shown, the master node update device 100 includes a first transmission module 110 and a selection module 120.
[0133] The first transmission module 110 is used to establish a connection with the slave node and transmit data.
[0134] The selection module 120 is used to select a new master node after performing N cycles of data transmission, so that the new master node can establish a connection with other nodes in the communication network.
[0135] The selection module 120 is specifically used to select the node following the current master node in the preset master node update order as the new master node.
[0136] Select module 120, which is specifically used to obtain the current power level and signal strength of each node; and determine a new master node based on the current power level and signal strength of each node.
[0137] Module 120 is selected, specifically for obtaining the voice data packet transmission trend of each node in the first N periods; obtaining the current signal strength, current power, and idle load of each node; and determining a new master node based on the voice data packet transmission trend of each node in the first N periods, as well as the current signal strength, current power, and idle load of each node.
[0138] Module 120 is selected specifically for the following: If no voice data packets are sent within N cycles, and each node only sends keep-alive information, a new master node is selected based on the signal strength and current battery level of each node; if a node sends voice data packets within N cycles, data transmission continues for (M-1)×N cycles. The voice data packet sending trend of each node is obtained based on the voice data packets sent by each node within these M×N cycles, and a new master node is determined based on the voice data packet sending trend, signal strength, current battery level, and idle load of each node.
[0139] Module 120 is specifically used to determine a node that meets a first condition as a new master node; the first condition is: the current battery level is the highest, and the idle load is greater than or equal to a preset first load threshold; if no node meets the first condition, a node that meets a second condition is selected as a new master node; the second condition is: the current battery level is greater than or equal to a preset battery level threshold, the idle load is greater than or equal to a preset second load threshold, and the signal strength is greater than a preset signal strength threshold; the first load threshold is greater than the second load threshold; if no node meets the second condition, a node that meets a third condition is selected as a new master node; the third condition is: the voice data packet transmission trend indicates that the voice data packet transmission is decreasing.
[0140] Select module 120, specifically used to send beacon packets, the beacon packets including timestamp, MAC address, and index of paired slave nodes; so that other nodes can establish connections with the master node based on the beacon packets and return their own MAC addresses; save the MAC addresses returned by the slave nodes, and send the MAC addresses and node numbers of all slave nodes that have established connections with it to all slave nodes.
[0141] In one implementation, after a preset time interval following the sending of the beacon packet, the time window corresponding to the slave node is entered.
[0142] In one implementation, the aforementioned communication network can be a communication network composed of multiple smart glasses. The master node and slave nodes in the communication network are different smart glasses.
[0143] The master node update device 100 provided in this application embodiment has the same implementation principle and technical effect as the aforementioned master node update method embodiment. For the sake of brevity, any parts not mentioned in the device embodiment can be referred to the corresponding content in the aforementioned master node update method embodiment.
[0144] Based on the same technical concept, this application also provides a master node update device for slave nodes deployed in a communication network, the master node update device including a second transmission module.
[0145] The second transmission module is used to establish a connection with the master node and transmit data.
[0146] The second transmission module is also used to send its own characteristic information to the current master node after performing N cycles of data transmission, so that the master node can select a new master node based on the characteristic information of each node.
[0147] The second transmission module is also used to send beacon packets in the time window corresponding to the current node in the next cycle, in order to establish connections with other nodes, if the current node is selected as the new master node.
[0148] The master node update device deployed on the slave node provided in this application embodiment has the same implementation principle and technical effect as the aforementioned master node update method embodiment. For the sake of brevity, any parts not mentioned in the device embodiment can be referred to the corresponding content in the aforementioned master node update method embodiment.
[0149] Please see Figure 5 This is an electronic device 200 provided in an embodiment of this application. The electronic device 200 includes: a processor 210 and a memory 220.
[0150] The memory 220 and processor 210 are electrically connected directly or indirectly to each other to achieve data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines. The memory 220 is used to store computer programs, such as those containing... Figure 4 The software functional module shown is the master node update device 100. The master node update device 100 includes at least one software functional module that can be stored in the memory 220 in the form of software or firmware or embedded in the operating system (OS) of the electronic device 200.
[0151] The processor 210 is used to execute executable modules stored in the memory 220, such as software function modules or computer programs included in the master node update device 100. At this time, the processor 210 is used to establish connections with slave nodes and perform data transmission; after executing N cycles of data transmission, a new master node is selected so that the new master node establishes connections with other nodes in the communication network.
[0152] Alternatively, the processor 210 is used to establish a connection with the master node and perform data transmission; after executing N cycles of data transmission, it sends its own characteristic information to the current master node so that the master node can select a new master node based on the characteristic information of each node; if the current node is selected as the new master node, it sends a beacon packet in the time window corresponding to the current node in the next cycle to establish a connection with other nodes.
[0153] The memory 220 can be, but is not limited to, RAM (Random Access Memory), ROM (Read Only Memory), PROM (Programmable Read-Only Memory), EPROM (Erasable Programmable Read-Only Memory), EEPROM (Electric Erasable Programmable Read-Only Memory), etc.
[0154] Processor 210 may be an integrated circuit chip with signal processing capabilities. The aforementioned processor can be a general-purpose processor, including a CPU (Central Processing Unit), NP (Network Processor), etc.; it can also be a DSP (Digital Signal Processor), ASIC (Application Specific Integrated Circuit), FPGA (Field Programmable Gate Array), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor, or processor 210 can be any conventional processor.
[0155] Among them, the aforementioned electronic devices 200 include, but are not limited to, personal computers, servers, etc.
[0156] This application also provides a computer-readable storage medium (hereinafter referred to as the storage medium) storing a computer program. When the computer program is run by a computer, such as the electronic device 200 described above, it executes the master node update method described above. The computer-readable storage medium includes various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory, a random access memory, a magnetic disk, or an optical disk.
[0157] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A master node update method, characterized in that, The method, applied to a master node in a communication network, includes: Establish a connection with the slave node and perform data transmission; After N cycles of data transmission, a new master node is selected so that the new master node can establish a connection with other nodes in the communication network.
2. The method according to claim 1, characterized in that, Selecting a new master node includes: According to the preset master node update order, the node following the current master node in the master node update order is taken as the new master node.
3. The method according to claim 1, characterized in that, Selecting a new master node includes: Obtain the current battery level and signal strength of each node; A new master node is determined based on the current power and signal strength of each node.
4. The method according to claim 1, characterized in that, Selecting a new master node includes: Obtain the voice data packet transmission trend of each node within the first N periods; Obtain the current signal strength, current battery level, and idle load of each node; Based on the voice data packet transmission trend of each node in the previous N periods, as well as the current signal strength, current power, and idle load of each node, a new master node is determined.
5. The method according to claim 1, characterized in that, Selecting a new master node includes: If no voice data packets are sent within N cycles, and each node sends keep-alive information, then a new master node is selected based on the signal strength and current battery level of each node. If a node sends voice data packets within N cycles, then data transmission continues for (M-1)×N cycles. Based on the voice data packets sent by each node within these M×N cycles, the voice data packet sending trend of each node is obtained. Based on the voice data packet sending trend, signal strength, current battery level, and idle load of each node, a new master node is determined.
6. The method according to claim 5, characterized in that, Based on the voice data packet transmission trend, signal strength, current battery level, and idle load of each node, a new master node is determined, including: The node that meets the first condition is identified as the new master node; the first condition is: the current power is the highest, and the idle load is greater than or equal to the preset first load threshold. If no node meets the first condition, the node that meets the second condition will be the new master node; the second condition is: the current power level is greater than or equal to a preset power level threshold, the idle load is greater than or equal to a preset second load threshold, and the signal strength is greater than a preset signal strength threshold; the first load threshold is greater than the second load threshold. If no node satisfies the second condition, the node that satisfies the third condition will be the new master node; the third condition is: the voice data packet sending trend indicates that voice data packets are being sent less and less.
7. The method according to claim 1, characterized in that, Establishing a connection with a slave node includes: Send a beacon packet, which includes a timestamp, MAC address, and index of the paired slave node; so that other nodes can establish a connection with the master node based on the beacon packet and return their own MAC address; Save the MAC address returned by the slave node, and send the MAC address and node number of all slave nodes that have established a connection with it to all slave nodes.
8. The method according to claim 7, characterized in that, After a preset time interval following the sending of the beacon packet, the corresponding time window for the slave node is entered.
9. A master node update method, characterized in that, The method, applied to any slave node in a communication network, includes: Establish a connection with the master node and perform data transmission; After performing N cycles of data transmission, it sends its own characteristic information to the current master node, so that the master node can select a new master node based on the characteristic information of each node; If this node is selected as the new master node, it will send beacon packets in the time window corresponding to this node in the next cycle to establish connections with other nodes.
10. A master node update device, characterized in that, The device, which is a master node deployed in a communication network, includes: The first transmission module is used to establish a connection with the slave node and perform data transmission. The selection module is used to select a new master node after N cycles of data transmission, so that the new master node can establish a connection with other nodes in the communication network.
11. A master node update device, characterized in that, The device, deployed as any slave node in a communication network, includes: The second transmission module is used to establish a connection with the master node and perform data transmission. The second transmission module is also used to send its own feature information to the current master node after performing N cycles of data transmission, so that the master node can select a new master node based on the feature information of each node. The second transmission module is also used to send beacon packets in the time window corresponding to the current node in the next cycle, in order to establish connections with other nodes, if the current node is selected as the new master node.
12. An electronic device, characterized in that, include: The system includes a memory, a processor, and a data transmission unit, wherein the memory and the processor are connected, and the data transmission unit is connected to the processor. The memory is used to store programs; The processor is configured to invoke a program stored in the memory and control the data transmission unit to execute the method as described in any one of claims 1-8, or to execute the method as described in claim 9.
13. A computer-readable storage medium, characterized in that, It stores a computer program that, when executed by a computer, performs the method as described in any one of claims 1-8, or performs the method as described in claim 9.