CN116033368B - Device discovery method, system, terminal device and chip system - Google Patents

Device discovery method, system, terminal device and chip system Download PDF

Info

Publication number
CN116033368B
CN116033368B CN202210609615.9A CN202210609615A CN116033368B CN 116033368 B CN116033368 B CN 116033368B CN 202210609615 A CN202210609615 A CN 202210609615A CN 116033368 B CN116033368 B CN 116033368B
Authority
CN
China
Prior art keywords
equipment
terminal
information
local group
terminal device
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202210609615.9A
Other languages
Chinese (zh)
Other versions
CN116033368A (en
Inventor
张相会
陈英涛
张梦龙
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Honor Device Co Ltd
Original Assignee
Honor Device Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Honor Device Co Ltd filed Critical Honor Device Co Ltd
Priority to CN202210609615.9A priority Critical patent/CN116033368B/en
Publication of CN116033368A publication Critical patent/CN116033368A/en
Application granted granted Critical
Publication of CN116033368B publication Critical patent/CN116033368B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Abstract

The embodiment of the application discloses a device discovery method, a system, terminal equipment and a chip system, which are applicable to the technical field of communication, wherein the method comprises the following steps: broadcasting target device information of the target device to the outside; receiving first equipment information broadcast by other terminal equipment; updating the local group of the target device based on the target device information and/or the first device information; and determining terminal equipment serving as a center node from the local group based on the updated equipment score in the local group, and obtaining the service network centering on the center node. The device discovery method provided by the embodiment of the application has stronger adaptability and fault tolerance.

Description

Device discovery method, system, terminal device and chip system
Technical Field
The present application relates to the field of communications technologies, and in particular, to a device discovery method, a system, a terminal device, and a chip system.
Background
In the context of daily life and work, interactive services are often required between terminal devices. Such as file sharing, digital media screening, call migration, etc. between the terminal devices. Before these interactive services are carried out, the terminal devices first find each other and inform the interactors of some basic information required for interaction. Therefore, how to find each other in time between the terminal devices is an important influencing factor for effectively performing the interactive service.
Disclosure of Invention
In view of the above, the embodiments of the present application provide a device discovery method, a system, a terminal device, and a chip system, which can solve the problem of poor adaptability in device discovery.
A first aspect of an embodiment of the present application provides a device discovery method, applied to a target device, including:
on the one hand, the target equipment information of the target equipment is broadcast outwards, and the target equipment information comprises the equipment score of the target equipment. On the other hand, first equipment information broadcasted by the first terminal equipment is received, the first equipment information comprises equipment scores of the first terminal equipment, and the first terminal equipment is other than the target equipment. And updating the local group of the target equipment based on the target equipment information and/or the first equipment information. The local group is recorded with at least one second terminal device and second device information of the second terminal device, each second device information comprises a device score of the corresponding second terminal device, and at least one second terminal device comprises a target device. And finally, determining the terminal equipment serving as the center node from the updated local group based on the equipment score in the updated local group, and obtaining the service network centering on the center node.
In the embodiment of the present application, devices that broadcast other than the target device are collectively referred to as first terminal devices, and the device information of the first terminal devices is referred to as first device information. Meanwhile, terminal devices recorded in the target device local group are collectively called second terminal devices, and the device information of the second terminal devices is called second device information. The target device itself is also recorded in the local group and is therefore also a second terminal device. The second terminal device other than the target device may be the same terminal device or may be a different terminal device from the first terminal device. If the second terminal device other than the target device broadcasts the second device information, the second terminal device is also the first terminal device, and the second device information is also the first device information.
In the embodiment of the application, the central node is selected by the target terminal according to the equipment score of each terminal equipment in the local group. In the process of device discovery, the local group content can be updated in time and the center node can be updated in real time according to the device information condition of the actual receiving end. Therefore, the embodiment of the application can cope with emergency situations in more practical applications. Therefore, compared with a fixed central node, the central node of the embodiment of the application is more freely and flexibly selected, has stronger adaptability and higher fault tolerance.
In a first possible implementation manner of the first aspect, before broadcasting the target device information of the target device to the outside, the method further includes: and obtaining the equipment state of the target equipment, grading the equipment state, and obtaining the equipment score of the target equipment. Wherein the device status includes content related to the energy consumption sensitivity.
By taking the content related to the energy consumption sensitivity as the scoring content, the selection from the central node of the energy consumption sensitivity dimension can be realized, so that the process energy consumption controllability of the whole equipment discovery is higher.
As an alternative embodiment, each content of the device states contains two quantized values of 0 and 1, and the weight coefficient of each content of the device states is an equal-ratio array with a common ratio of 2 after being ordered from small to large. Scoring the device status to obtain target device information, including:
And respectively quantizing each content of the equipment state to obtain a corresponding quantized value. And calculating the score of each content based on the quantized value of the equipment state content and the weight coefficient corresponding to each content. And taking the sum of the scores of all the contents of the device states as the device score of the target device.
In the embodiment of the application, the score and the value of the equipment state content of any item are unique. Therefore, the equipment score receiving end can quickly and accurately determine the conditions of the state contents of all the equipment of the equipment score transmitting end according to the equipment score. The whole process can not transmit the original data of the state content of each device, so that the data quantity required to be transmitted can be reduced. When broadcasting in the form of a message, the length of the message to be transmitted can be shortened.
In a second possible implementation manner of the first aspect, the device score of any terminal device is inversely related to the energy consumption sensitivity of the terminal device.
Determining a second terminal device as a central node from the updated local group based on the device score in the updated local group, comprising: and taking the terminal equipment with the highest equipment score in the updated local group as a central node.
In the embodiment of the application, the terminal equipment with the lowest energy consumption sensitivity is selected as the central node, so that the energy consumption in the whole equipment discovery process can be reduced. Meanwhile, when the equipment is found, the interference brought to the use of the terminal equipment by the user terminal due to the increase of the energy consumption is reduced, so that the user experience in the whole equipment finding process is improved.
In a third possible implementation manner of the first aspect, the broadcasting, to the outside, the target device information of the target device includes:
and periodically broadcasting the target equipment information of the target equipment information in a message form according to a preset period.
The preset period can be used for controlling the frequency of the external broadcast of the target device in the initial state. Therefore, the terminal equipment in the initial state can be timely and effectively discovered mutually.
In a fourth possible implementation manner of the first aspect, the local group includes one second terminal device as a central node, and a number of second terminal devices as edge nodes except the central node.
When the target device is a central node, broadcasting target device information of the target device to the outside, including:
and according to a preset leading period, broadcasting the target equipment information of the target equipment to the outside periodically. The target device information is used for indicating the edge node, and when the target device information is received, second device information of the edge node is broadcasted outwards.
And broadcasting the target equipment information of the target equipment outwards when the target equipment is an edge node. Receiving first device information broadcast by a first terminal device, including:
First device information broadcast by a first terminal device is received.
And when the received first device information contains the device information broadcasted by the central node, executing the operation of broadcasting the target device information of the target device outwards. The equipment information of the central node is periodically broadcast outwards by the central node according to a preset leading period.
For the second terminal device as an edge node, the own second device information is broadcast externally. The second terminal device is also the first terminal device, so the broadcasted second device information is also the first device information. The central node at this time can receive the first device information broadcast by the second terminal device.
In the embodiment of the application, after the service network is built, the central node actively and periodically broadcasts own equipment information outwards by leading the period. The edge node triggers a follow-up broadcast event after receiving the device information broadcast by the central node. I.e. broadcast its own device information to the outside. Since the central node is a periodic broadcast, the edge nodes may also implement periodic follow-up broadcasts. So that all terminal devices in the network can continuously receive the device information between each other. Terminal devices within the service network are enabled to be continuously and efficiently discovered to each other.
In a fifth possible implementation manner of the first aspect, updating the local group of the target device based on the target device information and/or the first device information includes:
And determining the terminal equipment which is not recorded in the local group and is contained in the first terminal equipment based on the first equipment information. And recording the device information broadcast by the terminal devices which are not recorded in the local group in the first device information into the local group so as to update the local group.
After receiving the device information of the new device, the embodiment of the application records the device information of the new device to the local group and triggers the operation of reselecting the central node. Therefore, the embodiment of the application can timely and effectively discover new equipment, so that the local group can be suitable for actual scene conditions, the new equipment is added to the network, and the scale of the local group is increased. Meanwhile, when new equipment is found, the central node is reelected in time, and the rationality and reliability of the central node can be maintained in real time, so that the adaptability and fault tolerance of the equipment are improved.
In a fifth possible implementation manner of the first aspect, updating the local group of the target device based on the target device information and/or the first device information includes:
And determining second terminal equipment with equipment score needing to be updated in the local group based on the target equipment information and/or the first equipment information, and updating the equipment score of the determined second terminal equipment so as to update the local group.
When the embodiment of the application detects that the equipment score of the terminal equipment in the local group is updated, the local group is updated in time, and the operation of reselecting the central node is triggered. Therefore, the embodiment of the application can effectively follow the actual state of each terminal device in the service network in time, and update the central node in time according to the actual state of each terminal device. Therefore, the rationality and reliability of the central node can be maintained, and the adaptability and fault tolerance of the equipment in discovery are improved.
In a seventh possible implementation manner of the first aspect, before determining the terminal device as the central node from the updated local group based on the device score in the updated local group, the method further includes:
and performing off-line detection on each second terminal device in the local group.
And removing the offline second terminal equipment determined by offline detection from the local group so as to update the local group.
In the embodiment of the application, the terminal equipment in the local group can actively and timely discover the terminal equipment with problems and detect whether the terminal equipment with problems is offline. And meanwhile, when the fact that the terminal equipment is offline is determined, the local group data is maintained at the first time, the central node is reselected, and the networking is realized. Therefore, the embodiment of the application can realize the timely discovery of the abnormal condition of the terminal equipment. Even if the central node or the edge node is abnormal, the embodiment of the application can rapidly reselect a new central node according to the actual situation to realize the networking again. Therefore, the fault tolerance rate to external factors is extremely high, the method can adapt to the influence of different external factors, and has extremely high adaptability and fault tolerance.
In an eighth possible implementation manner of the first aspect, performing offline detection on each terminal device in the local group includes:
and starting an offline detection timer after finishing the operation of broadcasting the target device information of the target device.
And when the offline detection timer reaches the corresponding timeout time, screening out second terminal equipment with the time difference between the equipment information updating time and the current time being larger than a preset offline threshold from the second terminal equipment recorded in the local group.
And respectively sending unicast acknowledgement messages to the screened second terminal equipment, and starting a timeout timer.
And when the timeout timer reaches the corresponding timeout time, judging the terminal equipment which does not receive the return unicast response message aiming at the unicast confirmation message in the screened second terminal equipment as the offline terminal equipment.
In the embodiment of the application, the online state of each terminal device is actively detected at fixed time, and when the possible offline situation is found, whether the terminal device is offline is confirmed by a more reliable unicast communication mode. The embodiment of the application can realize timely and accurate detection of whether the terminal equipment is offline or not.
In a ninth possible implementation manner of the first aspect, after receiving the first device information broadcast by the first terminal device, the method further includes:
and detecting whether the first terminal equipment comprises the terminal equipment in the dormant state or not according to the received first equipment information.
When the first terminal device comprises the terminal device in the dormant state and the target device does not broadcast the target device information of the first terminal device, the target device information of the target device is broadcast outwards. The first device information of the terminal device in the dormant state is broadcast by the terminal device in the dormant state during the period that the terminal device is in the response window.
In the embodiment of the application, the broadcasting of the device information is actively carried out by multiplexing the response window period of the dormancy device, and the device information is timely replied when the broadcasting of the dormancy device is received, so that the mutual discovery between the dormancy device and the awakening device is realized. Meanwhile, the multiplexing response window does not additionally trigger the awakening of the dormant device, so that the awakening times of the dormant device are not increased by the device discovery, and the energy consumption of the dormant device in the process of device discovery is greatly reduced.
A second aspect of an embodiment of the present application provides a device discovery apparatus, including:
And the broadcasting module is used for broadcasting the target equipment information of the target equipment outwards, wherein the target equipment information comprises the equipment score of the target equipment.
The receiving module is used for receiving first equipment information broadcast by the first terminal equipment, the first equipment information comprises equipment scores of the first terminal equipment, and the first terminal equipment is other than target equipment.
And the updating module is used for updating the local group of the target equipment based on the target equipment information and/or the first equipment information. The local group is recorded with at least one second terminal device and second device information of the second terminal device, each second device information comprises a device score of the corresponding second terminal device, and at least one second terminal device comprises a target device.
And the election module is used for determining the terminal equipment serving as the center node from the updated local group based on the equipment score in the updated local group to obtain the service network centering on the center node.
In a third aspect, an embodiment of the present application provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, the processor implementing a method according to any one of the first aspects described above when the computer program is executed by the processor.
A fourth aspect of an embodiment of the present application provides a device discovery system, including: a central node and a plurality of edge nodes, both the central node and the edge nodes being terminal devices according to the third aspect.
In a fifth aspect, embodiments of the present application provide a computer readable storage medium storing a computer program which when executed by a processor performs a method as in any of the first aspects above.
In a sixth aspect, an embodiment of the present application provides a chip system, including a processor, the processor being coupled to a memory, the processor executing a computer program stored in the memory to implement a method according to any one of the first aspects. The chip system can be a single chip or a chip module composed of a plurality of chips.
In a seventh aspect, an embodiment of the application provides a computer program product for, when run on a terminal device, causing the terminal device to perform the method of any of the first aspects above.
It will be appreciated that the advantages of the second to seventh aspects may be found in the relevant description of the first aspect, and are not described here again.
Drawings
Fig. 1 is a schematic flow chart of a basic networking in the device discovery method provided by the embodiment of the application;
fig. 2 is an interaction schematic diagram of two terminal device base networks provided in the embodiment of the present application;
FIG. 3A is an interaction diagram of a central node and an edge node according to an embodiment of the present application when updating a network;
fig. 3B is a schematic diagram of a scenario when a central node and an edge node update networking are provided in an embodiment of the present application;
Fig. 3C is a schematic flow chart of updating a network of a terminal device in the device discovery method according to the embodiment of the present application;
fig. 4 is a schematic flow chart of offline detection of a terminal device in the device discovery method provided by the embodiment of the application;
fig. 5 is an interaction schematic diagram of a sleep device and a wake-up device according to an embodiment of the present application;
Fig. 6 is a schematic structural diagram of a device discovery apparatus according to an embodiment of the present application;
Fig. 7 is a schematic diagram of a hardware structure of a terminal device according to an embodiment of the present application;
Fig. 8 is a schematic structural diagram of a mobile phone according to an embodiment of the present application;
Fig. 9 is a software structure block diagram of a terminal device according to an embodiment of the present application.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth such as the particular system architecture, techniques, etc., in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
The device discovery method provided by the embodiment of the application can be applied to terminal devices such as mobile phones, tablet computers and wearable devices, and the terminal devices are the execution main bodies of the device discovery method provided by the embodiment of the application, and the embodiment of the application does not limit the specific types of the terminal devices.
For a better understanding of embodiments of the present application, the following is a brief description of the embodiments of the present application:
In order to achieve mutual discovery of the terminal devices. In some alternative device discovery schemes, the device discovery operation is often performed only when the terminal device has an interactive service requirement. However, such a device discovery process is late-onset, lags behind the service requirements, and cannot discover terminal devices that can interact in time. Since two terminal devices are required to achieve the purpose of mutual discovery, they need to communicate with each other at least once successfully. Therefore, when more terminal devices are included in the scene, more message transfer is required between the terminal devices to realize device discovery. This may make the overall discovery of device discovery operations that lag the traffic demands less efficient.
In other alternative device discovery schemes, the efficiency of device discovery is improved. A technician may first manually select one of the terminal devices as a central node in a scenario involving a device group of a plurality of terminal devices. And based on the central node, networking the terminal devices in the group to obtain a service network so as to realize mutual discovery among the terminal devices before service requirements. This, while improving device discovery efficiency, is too dependent on the center node chosen by the technician. Once the situation of the terminal equipment in the actual scene changes, if a new terminal equipment is added or a central node is abnormal, the equipment discovery can not be normally performed between the terminal equipment. In practical application, the use of the terminal device is complex. The central node is easy to be powered off, network-lost, manually closed by a user, and too far from other terminal equipment, so that the central node is abnormal and cannot normally communicate with other terminal equipment in the group. And once the central node is abnormal, the terminal equipment cannot be normally networked, so that the equipment discovery cannot be normally carried out between the terminal equipment. From this, it is known that this device discovery method is more susceptible to external factors and has poor fault tolerance.
In order to improve the fault tolerance of device discovery, in the embodiment of the present application, on one hand, the terminal device evaluates its own device status and broadcasts the obtained own device score outwards. And selecting a proper center node based on the received equipment scores of the terminal equipment in the local group and the equipment scores of the terminal equipment. Thereby realizing the self-adaptive selection of the central node. On the other hand, when the equipment score of the terminal equipment in the local group changes or the terminal equipment is newly added or removed from the local group, the proper central node is adaptively updated again based on the equipment scores of the terminal equipment in the local group and the equipment scores of the terminal equipment. Therefore, the embodiment of the application can realize the self-adaptive selection and timely update of the central node according to the actual situation. Even if the central node has abnormal conditions in the using process, the embodiment of the application can rapidly reselect a new central node to realize the networking again. Therefore, the fault tolerance rate to external factors is extremely high, the method can adapt to the influence of different external factors, and has extremely strong adaptability and fault tolerance.
Some concepts or keywords that may be related to embodiments of the present application are described herein:
In the embodiment of the present application, a plurality means two or more.
Device information: in the embodiment of the application, some basic information required by interaction between terminal devices is collectively called as device information of the terminal devices. The specific information content contained in the device information can be determined by the skilled person according to the actual situation. For example, in some alternative embodiments, the device information may comprise the terminal device: any one or more of information such as device type, service capability, network communication capability, and identity information identification (e.g., device ID of terminal device). In alternative embodiments, more or less information may be included. For example, in some embodiments of the application, the device information may also contain a device score for the terminal device itself. The service capability refers to some service functions that can be provided by the terminal device, for example: photographing function, video playing function, audio playing function, printing function, etc.
Local group: in the embodiment of the application, the terminal equipment sets and maintains a local group aiming at a single communication mode. The local group is recorded with the terminal equipment and other terminal equipment discovered by the terminal equipment in the communication mode. In the embodiment of the present application, when the terminal device supports multiple communication modes at the same time, an independent local group may be selectively set for each communication mode, where each local group is associated with a corresponding communication mode. Correspondingly, removing or adding a terminal device in the local group refers to removing a recorded terminal device in the local group or adding an unrecorded terminal device in the local group. Alternatively, all communication methods may share a local group, and at this time, a communication method in which a certain terminal device supports discovery may be marked in the local group. At this time, the removal or the addition of the terminal device in the local group may be to remove or add the communication mode flag that the terminal device supports discovery. Wherein a terminal device in the local group may be selected for removal from the local group when all discovery-enabled communication means indicia for that terminal device are removed. The advantage of setting an independent local group for each communication mode is that the local group is managed independently and flexibly. The advantage of sharing a local group for all communication modes is that the data size of the local group can be reduced, and the occupation of the storage space of the terminal equipment is reduced.
By way of example, it is assumed that terminal device 1 supports both WiFi and bluetooth, terminal device 2 and terminal device 3 are discovered by way of bluetooth, and terminal device 3 and terminal device 4 are discovered by way of WiFi. An option at this time is to set up a separate local group for bluetooth, in which the terminal device 1, the terminal device 2 and the terminal device 3 are recorded. A separate local group is set up for WiFi, in which the terminal device 1, the terminal device 3 and the terminal device 4 are recorded. Alternatively, only one local group is set up, and terminal device 1, terminal device 2, terminal device 3, and terminal device 4 are recorded simultaneously in the local group. Terminal device 1 and terminal device 3 are labeled as supporting bluetooth and WiFi discovery, terminal device 2 is labeled as supporting bluetooth discovery, and terminal device 4 is labeled as supporting WiFi discovery. At this time, the communication mode mark supporting discovery for a certain terminal device can be removed or newly added in the local group, so that the terminal device can be removed or newly added in different communication modes. For example, the tag supporting bluetooth is removed from the terminal device 3, and it can be considered that the terminal device 3 is removed from the local group in the bluetooth communication mode. For another example, the tag that the terminal device 2 supports WiFi is newly added, and at this time, the local group newly adds the terminal device 2 in a communication manner that can be regarded as WiFi.
As an alternative embodiment of the present application, recording of each terminal device may be implemented in a manner of recording device information of the terminal device. That is, each device information includes an identity information identifier (such as a device ID or data such as a device account that can be used to distinguish identities of different terminal devices), if the device information of a certain terminal device is recorded in the local group, it can be determined that the terminal device is recorded in the local group through the identity information identifier in the device information.
Center node, edge node: the central node is one terminal device selected from all the terminal devices recorded in the local group by the terminal device as the execution subject. Meanwhile, the embodiment of the application refers to other terminal equipment except the central node in the local group as edge nodes. In the embodiment of the application, the central node actively and periodically broadcasts the external broadcast. The edge node will follow the broadcast after receiving the broadcast from the central node. The central node actively guides the broadcast and the edge node follows the broadcast, so that the state of continuous mutual discovery among all terminal devices in the local group can be kept.
Networking: unless otherwise specified, networking according to embodiments of the present application refers to the construction of a service network comprising a plurality of terminal devices. The terminal devices in the service network can find each other, so that when the service requirement exists, the terminal devices in the service network can respond to the service requirement in time to process related services. The successfully built service network generally comprises a central node and a plurality of edge nodes.
Target device, first terminal device, second terminal device, target device information, first device information, and second device information: in some embodiments of the present application, for convenience of explanation of the technical solution, the explanation of the embodiments will be performed with a single terminal device as an execution subject. In order to facilitate distinguishing a terminal device as an execution subject from other terminal devices, in the embodiment of the present application, the terminal device as an execution subject is also referred to as a target device, and device information of the target device is referred to as target device information. On this basis, devices other than the target device that perform broadcasting are collectively referred to as first terminal devices, and the device information of the first terminal devices is referred to as first device information. Meanwhile, the terminal devices recorded in the local group are collectively called second terminal devices, and the device information of the second terminal devices is called second device information. It should be appreciated that the target device may be either a central node or an edge node, depending on the circumstances of each particular embodiment. The target device itself is also recorded in the local group and is therefore also a second terminal device. Since the broadcasting terminal device may have already been recorded in the local group, it may be a new device that is not recorded in the local group. The second terminal device, which is other than the target device, may be the same terminal device as the first terminal device or may be a different terminal device. For example, when a second terminal device other than the target device broadcasts the second device information, the second terminal device at this time is also the first terminal device, and the second device information is also the first device information. The specific requirements are determined according to the embodiment, and are not limited herein.
In order to illustrate the device discovery technical scheme of the present application, in the following, device discovery is performed between terminal devices in a single communication manner. Meanwhile, the method for recording the equipment information is set, so that the recording of each terminal equipment is realized. Namely, the terminal devices mentioned in the following embodiments all support the same communication mode to perform device discovery and service interaction. And the local group of the terminal equipment records the equipment information of one or more terminal equipment. The embodiment of the application is described by different application scenes with reference to the accompanying drawings:
application scenario one: and the plurality of terminal devices perform device discovery and basic networking.
In the first application scenario, the terminal device is in an initial state of not networking with other terminal devices, and only one terminal device is in the local group at the moment, so that device discovery is needed. The terminal equipment can be judged whether to be in an initial state or not according to the condition of the terminal equipment recorded in the local group. If the local group recorded by a certain terminal device only contains one terminal device, the terminal device is in an initial state.
On the basis of the above description, reference may be made to fig. 1, which is a flowchart for implementing basic networking when a single terminal device discovers other devices and performs basic networking in the device discovery method provided by the embodiment of the present application, where the terminal device executing S101-S104 is the target device. The details are as follows:
S101, the terminal equipment scores based on the equipment state of the terminal equipment to obtain the equipment score of the terminal equipment.
S102, the terminal equipment periodically broadcasts equipment information containing the equipment score of the terminal equipment according to a preset period in the form of a message.
Before broadcasting the device information, the terminal device firstly scores the device state of the terminal device to obtain the corresponding device score. The specific scoring equipment status content and scoring method are not limited herein too much and can be set by the skilled person. In the embodiment of the application, the equipment score can be used for terminal equipment to select a central node from a local group.
As an alternative embodiment of the present application, one of the main differences considered between the center node and the edge nodes is: the central node actively and periodically guides the edge node to broadcast so that the state of mutual discovery among the terminal devices in the local group can be kept. When the actual terminal equipment is found, the central node needs to actively broadcast the information outwards more frequently, and the energy consumption is higher. Some device state content in the terminal device related to the energy consumption sensitivity can be selected as part of the scoring reference content. The central node which can be matched with the energy consumption requirement is selected conveniently, and the influence of the equipment discovery energy consumption on the use of the terminal equipment by the user is reduced as much as possible. For example, the state of charge, battery loss, etc. of the terminal device may be selected as part of the scoring reference content.
As another alternative embodiment of the present application, consider that the central node needs to keep running in the background to achieve active periodic broadcasting. This background run sensitivity is also a relatively important reference dimension. Meanwhile, the device discovery in the embodiment of the application is based on the fact that the same communication mode can be supported between the terminal devices, so that service interaction can be carried out between the terminal devices in the follow-up local group. Thus, the more communication modes a single terminal device supports, the greater the likelihood that it will be programmed to a local group corresponding to a different communication mode. At this time, if the terminal devices supporting multiple communication modes are selected as the central nodes of different local groups at the same time, the energy consumption of the whole terminal device for device discovery can be reduced. The type of communication scheme supported is therefore also a relatively important reference dimension. In summary, on the basis of the energy consumption sensitivity dimension, the embodiment of the application can also refer to the background operation sensitivity and/or the supported communication mode types at the same time. And uses some device state content related to background running sensitivity and/or supported communication mode types as partial scoring reference content. For example, for background operation sensitivity, the screen unlock state of the terminal device may be selected. Aiming at the communication mode type supported by the terminal equipment, whether the terminal equipment supports a wireless local area network (Wireless Local Area Network, WLAN), bluetooth (BT), bluetooth low energy (Bluetooth Low Energy, BLE), near field communication (NEAR FIELD communication, NFC), ultra Wideband (UWB) and other communication modes can be selected.
As an alternative embodiment of the application, the device status content to be used is determined. Corresponding weight coefficients can be set according to the importance degree of the equipment state contents to the central node selection. And simultaneously setting quantization rules of the state contents of the various devices. And quantizing the equipment state contents according to the quantization rule, and then carrying out weighted summation on the quantized values of the equipment state contents based on the set weight coefficients, thereby obtaining the final equipment score of the terminal equipment. In the equipment state content related to the energy consumption sensitivity, the energy consumption sensitivity is inversely related to the weight coefficient. I.e. the lower the energy consumption sensitivity, the larger the corresponding weight coefficient.
As an alternative embodiment of the present application, the device state content may be divided into two quantized values, 0 and 1. That is, a division criterion is set for each device state content, a quantization value is set to 1 above the division criterion, and a quantization value is set to 0 below the division criterion. And simultaneously setting the sum of the first m items to be smaller than the (m+1) th item after the weight coefficients are ordered from small to large. m is any positive integer greater than 1. For example, in some alternative embodiments, the number sequence obtained by sorting all the weight coefficients from small to large may be an equal-ratio number sequence with a common ratio greater than or equal to 2. And then, according to the importance degree of the equipment state content, corresponding weight coefficients are distributed. For example, in one embodiment, the number sequence obtained by sorting the weight coefficients from small to large is an equal ratio number sequence with a common ratio of 2. Meanwhile, the minimum weight coefficient is assumed to be 1, the equipment state content is 6, and the result of the sorting of the weight coefficients from small to large is as follows: 1. 2, 4, 8, 16, 32.
In the embodiment of the application, the device state content is divided into two quantized values of 0 and 1 through setting. And simultaneously setting the sum of the first m items to be smaller than the (m+1) th item after the weight coefficients of the state contents of all the devices are sequenced from small to large. Such as an array of equal ratios ordered by weight coefficients with a common ratio greater than or equal to 2. In the embodiment of the application, the score (i.e. the score obtained by multiplying the quantized value of the equipment state content by the corresponding weight coefficient) and the value of the equipment state content of any item are unique. Therefore, the equipment score receiving end can quickly and accurately determine the conditions of the state contents of all the equipment of the equipment score transmitting end according to the equipment score. The whole process can not transmit the original data of the state content of each device, so that the data quantity required to be transmitted can be reduced. When broadcasting in the form of a message, the length of the message to be transmitted can be shortened.
An example is illustrated. As an optional specific implementation manner in the present application, the charging state, the screen unlocking state, whether WLAN is supported, whether BLE is supported, and the battery state of charge of the terminal device may be selected as the device state content according to the scoring. Meanwhile, the equipment state contents are set to contain two quantized values of 0 and 1, and the number sequence obtained after the weight coefficients are sequenced from small to large is an equal ratio number sequence with the common ratio of 2. The importance of these several device state contents to the central node is: and the energy consumption sensitivity is taken as a core, and the background operation sensitivity and the supported communication mode are the second. At this time, quantization rules, weight coefficients, and scoring rules may be set as follows:
the state of charge quantization value is taken to be 1 when the state of charge is in the state of charge (i.e., in charge), otherwise, to be 0. The weight coefficient is 16.
And when the screen unlocking state is that the screen is unlocked, the screen unlocking state quantized value is taken as1, otherwise, 0 is taken. The weight coefficient is 8.
And when whether the WLAN is supported for supporting the WLAN mode messaging, whether the WLAN quantization value is 1 is supported, otherwise, 0 is selected. The weight coefficient is 4.
And when whether BLE is supported for message transceiving in a BLE supporting mode, whether a BLE quantization value is supported is taken as 1, otherwise, 0 is taken. The weight coefficient is 2.
And when the battery state of charge is that the current battery state of charge ratio is more than 50%, the quantized value of the battery state of charge is taken as 1, otherwise, the quantized value of the battery state of charge is taken as 0. The weight coefficient is 1.
The corresponding scoring rules are:
nodeScore=16×isChargin+8×isUnlock+4×isWlanSup+2×isBLESup+batteryFlag
Wherein nodeScore is the device score of the terminal device. ISCHARGIN, ISUNLOCK, ISWLANSUP, ISBLESUP and batteryFlag, respectively: a state of charge, a screen unlock state, whether WLAN is supported, whether BLE is supported, and a quantized value of battery state of charge.
In the embodiment of the application, the device state content is selected and the corresponding weight coefficient is set by taking the energy consumption sensitivity as a core and the background operation sensitivity and the supported communication mode are the next mode. The final device score is positively correlated with the matching degree of the terminal device as a central node, and has the highest correlation with the energy consumption sensitivity. And by setting the two quantized values of 0 and 1 through the equipment state content and setting the weight coefficient to an equal-ratio number sequence with the common ratio of 2, the score and the value of any equipment state content can be unique. Therefore, the message length required to be transmitted is shortened, and meanwhile, the receiving end can rapidly determine the state content conditions of each device of the terminal device through the device score. For example, when the final device score is 31, it may be determined that the device status is: during charging, the screen is unlocked, WLAN and BLE mode message receiving and transmitting are supported, and the current battery power ratio is more than 50%. When the device score is 15, it may be determined that the device status is: the device is not in charging, the screen is unlocked, WLAN and BLE mode messaging is supported, and the current battery power ratio is greater than 50%.
In order to allow mutual discovery between the terminal devices in the initial state. After calculating the self equipment score, the terminal equipment in the initial state in the embodiment of the application takes the equipment score as a part of the content of the self equipment information, and periodically broadcasts the self equipment information to the outside in a message form according to a preset period. In the embodiment of the application, the mode of periodically broadcasting the outside of the terminal equipment is not excessively limited in the initial state. For example, in some alternative embodiments, an initial broadcast period may be preset, and when the terminal device is in an initial state, the terminal device actively broadcasts its own device information outwards in the initial broadcast period. In other alternative embodiments, the terminal device in the initial state may be set to default to the central node. And meanwhile, the central node is set to actively broadcast own equipment information outwards in a lead period. The specific values of the initial broadcast period and the lead period, which are the preset periods, may be set by the skilled person, and are not limited herein. Meanwhile, the embodiment of the application does not limit the duration time of the terminal equipment during external broadcasting too much, and can be set by a technician. For example, in some embodiments, any value within 2-10 seconds may be set. For example, it may be set to 5 seconds, and the terminal device will perform an outbound broadcast with a duration of 5 seconds each time.
It should be noted that, in the embodiment of the present application, the operation of scoring the own device status by the S101 terminal device and the operation of periodically broadcasting the external broadcast by the S102 may be performed synchronously or asynchronously. Wherein the synchronization means: the terminal device also operates periodically on its own device status score and is synchronized with the period of the outbound broadcast. At this time, the terminal device may score the device status in the preset period, and broadcast the device status after each time the device score is obtained. Asynchronous means: the terminal device may be relatively independent of the own device status scoring operation, and may be periodic (the period in this case is inconsistent with the period of the outbound broadcast) or aperiodic. At this time, the terminal device may perform S102 an operation of the external periodic broadcast with the latest device score.
For example, assume that the period of the external broadcast by the terminal device in S102 is 30 seconds. The terminal device may perform the device status scoring at this time with a longer or shorter period, such as performing the device status scoring of S101 every 10 seconds or 60 seconds. Or the terminal device may choose to perform the device state scoring of S101 once only if it finds that its own device state is updated. At this time S101 belongs to an aperiodic operation.
S103, the terminal equipment receives the equipment information broadcast by other terminal equipment and detects whether the local group needs to be updated or not based on the received equipment information and the equipment information of the terminal equipment. The received device information contains the device score of the transmitting end.
It should be noted that a device discovery scenario in practical applications often has a plurality of terminal devices. In the embodiment of the application, the device discovery methods of the terminal devices are consistent. The embodiments of the present application will be described with respect to a single terminal device as an execution subject.
In the embodiment of the application, the terminal equipment in the initial state can execute the steps of scoring the self equipment state and broadcasting outwards. Thus, for a single terminal device, on the one hand, the own device information, i.e. the target device score, is broadcast to the outside, and on the other hand, the device information broadcast by other terminal devices is also received. At this time, other terminal devices broadcasting the device information to the outside may also be referred to as a first terminal device, where the broadcasted device score is the first device score.
After receiving the device information broadcast by other terminal devices, the terminal device compares the device information with the device information of the terminal devices recorded in the local group. Whether there is a new addition of the terminal device or a device score change of the terminal device is judged. If some device information is not recorded in the local group, it is indicated that other devices broadcasting the device information belong to undiscovered devices, and at this time, the device information needs to be newly added in the local group. If a certain device information is recorded in the local group, the device score in the recorded device information is inconsistent with the device score in the latest obtained device information. Then a device score update for the terminal device is illustrated. Meanwhile, there may be a change in the device state for the terminal device itself as the execution subject, for example, the screen unlock state may change from screen unlocked to screen unlocked, the charge state may change from charge to uncharged, and so on. The terminal device also updates its own device score according to its own device status. And therefore device score update detection is also required. The terminal device recorded in the local group may also be referred to as a second terminal device, and the corresponding device information may be referred to as second device information.
In the embodiment of the application, the newly added terminal equipment and the equipment score update of the terminal equipment are regarded as trigger conditions for carrying out local group update. Therefore, when a new terminal device is detected or a device score of the terminal device is updated, it can be determined that the local group update is required. It should be noted that, since the terminal device in the initial state includes only its own device information in its local group, it can theoretically be determined that the terminal device is newly added when the device information is received.
It should be noted that, in the embodiment of the present application, the broadcasting of the information of the terminal device itself and the receiving operation of the information of the other terminal devices may be performed simultaneously or in sequence. That is, the execution order of S102 and S103 is determined according to the actual application, and is not limited herein.
In view of the update operation of the own device score of the terminal device, it is possible to not depend on whether or not device information broadcast by other terminal devices is received. Thus, as an alternative embodiment of the present application, the resulting local group update detection operation for the device score update of the terminal device itself may be independent from S103. At this time S103 may be replaced with: the terminal device receives device information broadcast by other terminal devices and detects whether the local group needs to be updated based on the received device information. Meanwhile, the embodiment of the application can add an operation independent of S103: the terminal device detects whether the local group needs to be updated based on the device score in the own device information. Correspondingly, when the terminal equipment discovers that the state of the equipment changes and the equipment score is updated, the terminal equipment can also judge that the local group needs to be updated.
And S104, when the local group needs to be updated, the terminal equipment updates the local group based on the received equipment information and/or the equipment information of the terminal equipment, and determines the terminal equipment serving as a central node in the local group according to all the equipment scores recorded in the local group.
When it is detected that the local group needs to be updated, it is indicated that the current device discovery status is not up-to-date. It is therefore necessary to update the networking, i.e. update the local group and reselect the central node, to prevent the subsequent interactive traffic from being affected. Wherein updating the local group includes, but is not limited to: recording unrecorded device information to the local group, and updating the device score with the change in the local group to the latest acquired device score. As the device score of each terminal device may vary in practice. Therefore, it is determined according to the actual situation whether the update terminal device is based on the received device information, the device information of the terminal device itself is updated, or both.
After the local group is updated, embodiments of the present application sort based on the device scores of all the terminal devices recorded within the local group. When the device score is inversely related to the energy consumption sensitivity, the election of the terminal device with the highest device score can be taken as a central node. Otherwise, if the device score is positively correlated with the energy consumption sensitivity, the election of the terminal device with the lowest device score may be taken as the central node. I.e. preferentially selecting the terminal equipment with the lowest energy consumption sensitivity and capable of supporting higher energy consumption as a central node. For example, if the weight coefficient of the device state content with lower energy consumption sensitivity is set higher, the weight coefficient of the device state content with higher energy consumption sensitivity is set lower. After the equipment state of a certain terminal equipment is scored, the higher the equipment score is, the lower the consumption sensitivity of the terminal equipment is, the higher the energy consumption can be born, and the terminal equipment is suitable to be used as a central node. Therefore, the terminal device with the highest device score in the local group can be selected as the central node at the moment.
As an alternative embodiment of the present application, if the scoring process is performed, the scoring of the devices of the plurality of terminal devices is the same and the energy consumption sensitivity is the lowest. At this time, according to the actual scene requirement, a corresponding secondary ordering rule can be set again so as to realize the selection of the unique center node. At this time, it may be set as: the priority relation corresponding to a plurality of different equipment types is preset, and the equipment information comprises the equipment types of the terminal equipment. At this time, the terminal devices with the lowest energy consumption sensitivity and the same priority can be ranked according to the device type in the device information and the preset priority relation. And selecting the terminal equipment with the highest priority as a central node. As an alternative embodiment of the present application, consider that in an actual interactive service, the mobile phone is used as a service center in many cases. The priority relationship can thus be set as: the priority of the mobile phone is higher than that of the tablet personal computer. To accommodate the needs of the actual business scenario.
As yet another alternative embodiment of the present application, if a unique central node cannot be selected from the local group based on both the device score and the device type. At this point, some screening schemes may be set up again for screening. For example, assuming that the device information includes a device ID, the terminal devices with the lowest energy consumption sensitivity and the same terminal devices can be ordered according to the Ascall codes of the device ID, and the terminal device with the highest Ascall codes is selected as a central node. Or a random selection algorithm is set, and one terminal device with the lowest sensitivity to the energy consumption and the same terminal device is randomly selected as a central node.
After the operations via S101 to S104, at least one communication may be completed between the terminal devices in the form of mutual broadcasting, thereby realizing mutual discovery with other terminal devices, completing the basic networking operation centering on the center node. And meanwhile, the device information of the discovered terminal devices is recorded in the local group, and the device information contains basic information required for interaction between the terminal devices. Therefore, after finishing the mutual broadcast discovery, if the service requirement exists, the terminal equipment can quickly respond to the service requirement and process the service. Communication conditions are established prior to service requirements, so that equipment discovery efficiency is improved. Meanwhile, the central node for leading broadcast in the embodiment of the application is self-elected among the terminal devices. And in the course of device discovery, the central node may be updated in real time as new devices join and the device status of any terminal devices within the local group is updated. Therefore, compared with a fixed central node, the central node of the embodiment of the application is more free and flexible to select, has stronger adaptability and higher fault tolerance. Moreover, based on equipment scoring and central node election with energy consumption sensitivity as a core, the overall energy consumption of equipment discovery in the embodiment of the application can be smaller, the influence on the energy consumption of a user using terminal equipment is smaller, and the user experience can be improved.
Application scenario one is illustrated below with some examples:
It is assumed that there are n terminal devices in an initial state within the scene, where n is a natural number greater than 1. It is also assumed that the device score is inversely related to the energy consumption sensitivity. The terminal equipment in the initial state defaults to take the terminal equipment as a central node, and broadcasts the equipment information of the terminal equipment with a leading period.
The embodiment of the application can be described in two cases according to the numerical value of n: case 1 and case 2.
Case 1: n=2, terminal device 1 and terminal device 2, respectively.
Referring to fig. 2, there is a schematic diagram of interactions when the terminal device 1 and the terminal device 2 are networked on a basis.
View angle of terminal device 1:
S1011, the terminal apparatus 1 calculates its own apparatus score based on its own apparatus state.
And S1021, the terminal equipment 1 periodically broadcasts the equipment information containing the equipment score of the terminal equipment according to a preset period in the form of a message.
S1031, the terminal device receives the device information broadcast by the terminal device 2, and detects whether the device score of the terminal device 1 itself is updated.
S10411, recording the device information broadcasted by the terminal device 2 to the local group, and updating the device score of the terminal device 1 in the local group when the device score of the terminal device 1 itself is updated.
S10412, when the device score of the terminal device 1 is higher than the device score of the terminal device 2, the terminal device 1 is still the center node. When the device score of the terminal device 1 is lower than the device score of the terminal device 2, the terminal device 2 is regarded as a center node.
View angle of terminal device 2:
s1012, the terminal device 1 calculates its own device score based on its own device state.
And S1022, the terminal equipment 2 periodically broadcasts the equipment information containing the equipment score of the terminal equipment according to a preset period in the form of a message.
S1032, the terminal device receives the device information broadcast by the terminal device 1, and detects whether the device score of the terminal device 2 itself is updated.
S10421, recording the device information broadcasted by the terminal device 1 to the local group, and updating the device score of the terminal device 2 in the local group when the device score of the terminal device 2 itself is updated.
S10422, when the device score of the terminal device 1 is higher than the device score of the terminal device 2, the terminal device 1 is regarded as the center node. When the device score of the terminal device 1 is lower than the device score of the terminal device 2, the terminal device 2 is still a central node.
Since the device terminal 1 and the device terminal 2 both broadcast the device information containing the own device score in the out-of-the-lead period. Both of them receive the device information of the other party. The logic of the underlying networking of device terminal 1 and device terminal 2 is the same. The details, principles, and beneficial effects of each step are described as follows: s1011 and S1021 may refer to the related description of S101, S1021 and S1022 may refer to the related description of S102, S1031 and S1032 may refer to the related description of S103, and S10411, S10412, S10421 and S10422 may refer to the related description of S104. The details of the parts are not described in detail here:
Since both the terminal device 1 and the terminal device 2 in the initial state default themselves to be the center nodes. Therefore, in S10412 and S10422, when the self-device score is detected to be high, the self-device is kept as the center node. When the self-equipment score is detected to be low, the opposite party is taken as a central node, and the self-equipment is taken as an edge node.
After the terminal device 1 and the terminal device 2 successfully find each other and perform basic networking, the local groups of the terminal device 1 and the terminal device 2 both contain the device information of the two terminal devices, and the initial state is ended.
Case 2: n >2, and at least 3 terminal devices.
Assuming that the terminal device 1 is the terminal device that broadcasts device information earliest among n terminal devices, case 2 can be subdivided into two cases at this time: subdivision case a and subdivision case b.
View angle of terminal device 1:
subdivision case a: after the external broadcast, the terminal device 1 receives the device information of only one terminal device for the first time.
At this time, the transmitting end of the device information received for the first time can be regarded as the terminal device 2 in fig. 2. I.e. essentially also mutual discovery and basic networking between two terminal devices. Reference may be made specifically to the description of the embodiment shown in fig. 2, and details thereof are omitted herein.
Subdivision case b: after the external broadcast, the terminal device 1 receives the device information of a plurality of terminal devices at the same time for the first time.
When n-1 terminal devices outside the terminal device 1 are provided with a plurality of devices, the devices broadcast outwards simultaneously, and the broadcasting time is earlier than that of other terminal devices. It is possible that the terminal device 1 receives device information of a plurality of terminal devices at the same time. These terminal apparatuses that broadcast simultaneously to the outside can be regarded as the terminal apparatus 2 in fig. 2. The steps of device discovery in the embodiment of the present application are substantially the same as those in the embodiment shown in fig. 2, and specific reference may be made to the description related to the embodiment shown in fig. 2. The difference from the embodiment shown in fig. 2 is that there are now a plurality of terminal devices 2, so that both the terminal device 1 and the local group of terminal devices 2 contain at least 3 terminal devices. I.e. at this time at least 3 terminal devices are contained in the infrastructure.
The external broadcasting time is not necessarily completely synchronized because of the terminal devices in each initial state. Therefore, in practical application, after the basic networking, the networking needs to be updated for multiple times, so that all n terminal devices can be built into one service network to complete the networking of n terminal devices. At this point, reference may be continued to application scenario two.
And (2) an application scene II: the terminal equipment periodically maintains local group data and updates the networking.
In order to enable efficient device discovery states to be maintained between the various terminal devices within the local group. Meanwhile, in order to continue to discover new terminal equipment, the equipment discovery effect is improved, so that the equipment discovery method is suitable for various condition demands of actual scenes. After the plurality of terminal devices complete the basic networking or networking under other conditions, each terminal device in the embodiment of the application also maintains the local group regularly and updates the networking. The details are as follows:
Referring to fig. 3A, at this time, the local group of terminal devices includes: a central node and a plurality of edge nodes, each operating as follows:
and S301, the center node periodically broadcasts the equipment information containing the own equipment score in the form of a message according to a preset leading period.
S302, after receiving the device information broadcasted by the central node, the edge node broadcasts the device information containing the device score of the edge node in the form of a message.
In the embodiment of the application, the central node is responsible for leading the terminal devices in the local group to broadcast the device information mutually. Specifically, the central node actively broadcasts its own device information periodically to the outside in a lead period. The edge node triggers a follow-up broadcast event after receiving the device information broadcast by the central node. I.e. broadcast its own device information to the outside. Since the central node is a periodic broadcast, the edge nodes may also implement periodic follow-up broadcasts. So that all terminal devices in the network can continuously receive the device information between each other. Meanwhile, the terminal equipment outside the local group can be enabled to be found, and the existence of the terminal equipment in the local group can be found. The specific values of the lead period are not limited herein and can be set by the skilled person. In addition, the embodiment of the application does not excessively limit the duration of each external broadcast by the central node and the edge node, and can be set by a technician, for example, can be set to any value from 1 second to 5 seconds. For example, the number of times of transmission of each broadcast message and the time interval of each transmission may be preset, so as to set the duration of a single broadcast. For example, in some embodiments, each broadcast may be configured to include 10 transmissions of the broadcast message, with each transmission of the broadcast message being 500 milliseconds. The corresponding duration of the single broadcast is 5 seconds.
As an optional implementation manner of S301, the central node may start a period timer, and set the timeout period of the timer to a duration corresponding to the lead period. Each time the period timer reaches the timeout time, an operation of broadcasting outside is performed, and the period timer is reset at the same time.
The embodiment of the application does not limit the scoring time of the central node and the edge node to the self equipment state excessively. For example, it is possible to update its own device score once before the external broadcast each time, and to externally broadcast the updated device score as the content of the device information. The device score itself may be updated in a separate operation. At this time, in S301 and S302, the center node and the edge node read the latest device score of themselves, and then broadcast the latest device score as the content of the device information.
As can be seen from the description in the application scenario one, the terminal device in the initial state periodically broadcasts its own device information to the outside. As an embodiment of the present application, the terminal device in the non-initial state stops its periodic external broadcasting in the initial state, and performs periodic broadcasting in the manner of S301 or S302. Among them, as a specific case: and setting the broadcasting period in the initial state of the terminal equipment to be consistent with the leading period. At this time, for the terminal device selected as the center node, it is possible to continue to maintain the external broadcast during the lead period.
S303, after receiving the device information broadcast by other terminal devices, the central node and the edge node detect whether the local group needs to be updated based on the received device information and the device information of the central node and the edge node.
In the embodiment of the application, the terminal equipment which is not recorded in the local group is called as new equipment. In the embodiment of the application, the center node and the edge node update and reorganize the local group when the device score of the local group is updated and new devices are found. Therefore, after receiving the device information broadcast by other terminal devices, the center node and the edge node both analyze the device information to determine the following contents:
1. And determining whether the device information is broadcasted for the new device according to the device information condition recorded by the local group. If the received device information is not recorded in the local group, the device information indicates that the device is a new device, and the local group needs to be updated.
2. If the received device information is already recorded in the local group, comparing with the locally recorded device information, and determining whether the device score in the device information is changed. If the device information changes, the terminal device transmitting the device information indicates that the device state is updated and the local group needs to be updated.
In practice, for the central node, it may receive device information broadcast by each edge node in the local group, and may also receive device information broadcast by the new device. For an edge node, it may receive device information broadcast by a central node in the local group, device information broadcast by other edge nodes in the local group, and device information broadcast by new devices.
In addition, the center node and the edge node also analyze own equipment information to determine whether own equipment scores change or not. The acquired self latest equipment score is compared with the self equipment score stored in the local group. If there is a difference, it is indicated that a change has occurred, and a local group update is required. As an optional embodiment of the present application, the operation of determining whether the center node and the edge node need to update the own device score may also be performed independently of the operation of receiving the device information of other terminal devices. At this time S303 may be modified as: and after receiving the device information broadcast by other terminal devices, the center node and the edge node detect whether the local group needs to be updated or not based on the received device information.
As an alternative embodiment of the application, to improve the efficiency of device discovery. In the embodiment of the application, after receiving the device information sent by the new device, the central node and the edge node trigger a broadcast event, and the broadcast event can be independent of the periodic broadcast event led by the central node. At this time, the center node and the edge node broadcast the device information including the device score of the center node and the edge node. So that the new device can also receive the device information of the center node and the edge node in the first time, trigger the re-networking of the new device, and improve the mutual discovery efficiency of the center node, the edge node and the new device.
S304, after receiving the device information broadcast by the terminal device which is not recorded in the local group, the center node and the edge node broadcast the device information containing the self device score in the form of a message.
It should be appreciated that the broadcast may occur periodically as a result of the central node and the edge nodes. So that even if the operation of S304 is not performed, the new device will eventually discover the center node and the edge nodes and re-networking. Thus, in alternative embodiments, after the new device is discovered, it may be selected not to perform S304 an operation that would trigger a broadcast event.
Wherein as an alternative embodiment of the application. Considering that in practical application, the situation that the central node or the edge node is still broadcasting, the device information broadcast by the new device is received may occur. Since the center node and the edge node are still continuously broadcasting at this time, the new device can discover the center node and the edge node even if the center node and the edge node do not re-broadcast. Based on this, in the embodiment of the present application, after receiving the device information broadcast by the new device, the central node and the edge node identify whether the current state is in broadcast. If the broadcast state is in progress, the re-broadcast may not be performed, and if the broadcast state is not in progress, the broadcast may be performed. At this time S304 may be replaced with: when receiving the device information broadcast by the terminal devices which are not recorded in the local group, the center node and the edge node broadcast the device information containing the device score of the center node and the edge node in the form of a message if the center node and the edge node are not in the broadcast state.
As an alternative embodiment of the present application, whether the terminal device is in a broadcasting state may be determined by calculating whether a time difference between a current time and a previous broadcast event is less than a single broadcast duration. If the time difference is smaller than the duration, the terminal device is not completed in the last broadcasting event, namely, is still in a broadcasting state. If the time difference is equal to the duration, the terminal device is stopped from the last broadcasting event, and is not in broadcasting.
As an alternative embodiment of the application, some new devices are not necessarily trusted in view of practical application. For example, some illegal devices may be possible. Therefore, in order to improve the security of the terminal equipment in the local group, the security of the service interaction between the subsequent terminal equipment is improved. In the embodiment of the application, the center node and the edge node can perform reliability verification on the new equipment. If the new device is trusted, it is joined to the local group and re-networked. If the new device is not trusted, it is disregarded. At this point neither the new device is responded to a broadcast event nor the update to the local group in S303 is triggered. At this time, both S303 and S304 may add a judgment condition, that is, when the center node and the edge node receive the device information of the new device, it is identified whether the new device is trusted. If so, an operation of detecting whether the local group needs to be updated in S303 is performed, and an operation of broadcasting own device information to the outside in S304 is performed.
As a specific implementation manner for detecting whether the new equipment is trusted or not in the application, the terminal equipment in the local group can be set to use the same account number, namely only the equipment information from the terminal equipment with the same account number is processed, and the account number of the terminal equipment is contained in the equipment information. On the basis, when the central node and the edge node receive the message broadcast by the new equipment, the account number of the new equipment can be checked to be the same as the account number of the new equipment through the message. If the account numbers are the same, the new equipment is judged to be trusted. If the account numbers are not the same, the new equipment is judged to be not trusted.
And S305, when the local group needs to be updated, the center node and the edge node update the local group based on the received equipment information and/or the own equipment information, and determine the terminal equipment serving as the center node in the local group according to the equipment scores recorded in the local group.
When it is detected that the local group needs to be updated, it is indicated that the current device discovery status is not up-to-date. It is therefore necessary to update the networking, i.e. update the local group and reselect the central node, to prevent the subsequent interactive traffic from being affected. Thus, networking centered on the updated central node is completed. The operation details, principles, and advantages of S305 are substantially the same as those of S104, and after the terminal device serving as the execution body in S104 is replaced by a center node and an edge node, reference may be made to the description related to S104, which is not repeated here.
The embodiment shown in fig. 3A is illustrated by way of example. It may be assumed, referring to fig. 3B, that m terminal devices are included in the local group, and m terminal devices are included in the service network at this time. The center node is terminal equipment 1, and the rest is m-1 edge nodes. While one terminal device m +1 is a new device. m is a natural number greater than 1.
At this time, the terminal device 1 as the central node performs the operation of S301 to actively broadcast its own device information to guide the edge node to broadcast the event. Whereas the terminal device 2, being an edge node, will follow the terminal device 1 to broadcast its own device information to the terminal device m. On the other hand, the terminal device m+1 will also broadcast its own device information to the outside.
After receiving the broadcast from the terminal device m+1, the terminal device 1 in the local group triggers a new device network access broadcast event. On the one hand, the terminal device 1 responds to the broadcast of the terminal device m+1, namely, the terminal device m broadcasts the device information of the terminal device m. On the other hand, the terminal device 1 and the terminal device m add the device information of the terminal device m+1 to the local group, and reselect the central node according to the device score included in the updated device information in the local group.
After receiving the device information broadcast by the terminal device 1 and the terminal device m, the terminal device m+1 also records the device information into the local group, and reselects the central node according to the device score contained in the updated device information in the local group.
It is assumed that the device score of the terminal device 1 is still highest within the updated local group. In the new local group obtained here, terminal device 1 is still acting as a central node, while terminal device 2 is acting as a new edge node to terminal device m+1. Thereby realizing the maintenance and update of the local group and completing the networking operation with the terminal equipment 1 as the center and containing m+1 terminal equipment.
Corresponding to the center node and edge node operations in fig. 3A, referring to fig. 3C, the operations when a single terminal device is the execution subject are as follows:
And S301', when the terminal equipment is a central node, periodically broadcasting equipment information containing the equipment score of the terminal equipment in the form of a message according to a preset leading period.
S302', when the terminal equipment is an edge node, after receiving the equipment information broadcasted by the central node, the terminal equipment comprises the equipment information of the own equipment score and broadcasts outwards in the form of a message.
And S303', after receiving the device information broadcast by other terminal devices, the terminal device detects whether the local group needs to be updated or not based on the received device information and the device information of the terminal device.
And S304', after receiving the device information broadcast by the unrecorded terminal devices in the local group, the terminal devices broadcast the device information containing the device scores of the terminal devices in a message form.
And S305', when the local group needs to be updated, the terminal equipment updates the local group based on the received equipment information and/or the own equipment information, and determines the terminal equipment serving as a central node in the local group according to the equipment scores recorded in the local group.
In the embodiment of the present application, when the terminal device is the central node, the operation of S301' leading to broadcast is performed. And if the terminal device is an edge node, the operation of following the broadcast is performed S302'. The operation details, principles, and advantages of S301 'to S305' are the same as S301 to S305, and thus reference may be made to the description of S301 to S305, which will not be repeated here.
It should be noted that S301 to S305 are a procedure of continuous updating. The method can be suitable for the basic networking obtained in the application scene, and can also be suitable for the networking obtained in other conditions. For example, the networking obtained after updating the basic networking. After the operations of S301 to S305, periodic communication can be maintained between terminal devices within the local group, thereby maintaining an efficient device discovery state between each other. Meanwhile, when the terminal equipment in the local group has equipment state update and new equipment is added, the local group can be timely discovered and updated. The local group can be suitable for actual scene conditions, new equipment is added to the network, and the local group scale is increased. And realizing the regular maintenance of the local group and updating the networking.
And (3) an application scene III: and (5) offline detecting the equipment, updating the local group data and re-networking.
In practical applications, any terminal device may be abnormal due to various internal or external factors, resulting in offline terminal device. Such as a change in the physical location of the terminal device or a change in communication capabilities, etc., resulting in an offline. The off-line terminal equipment cannot normally perform service interaction with other terminal equipment, so that the off-line terminal equipment needs to be removed from a local group in time and is re-networked.
Based on the second application scenario, in the embodiment of the present application, all terminal devices in the local group detect online states of other terminal devices in the local group at regular time. And when the offline terminal equipment is found, timely removing the offline terminal equipment from the local group. Taking the example that the execution body is a single terminal device as an example, referring to fig. 4, the following details are described:
s401, after the terminal equipment completes the event of broadcasting the self equipment information externally, starting an offline detection timer.
In the embodiment of the present application, the terminal device as the execution subject may be a central node or any edge node within the local group. The off-line detection timer is used for triggering off-line detection operation of the terminal equipment. If the terminal device has started the offline detection timer before S401, the started offline detection timer may be reset at this time to re-time.
Considering that the central node itself will broadcast one unit of duration outwards, the edge node will also broadcast one unit of duration outwards after receiving the broadcast of the central node. It is therefore theoretically possible that the central node may delay the time difference of two durations at most before receiving the device information broadcast by the edge node. Based on this, in the embodiment of the present application, the timeout time of the offline detection timer is set to be T2, and in the embodiment of the present application, T2>2DurationBC. Wherein DurationBC is the duration of a single outbound broadcast by the terminal device. To prevent premature detection of equipment off-line inaccuracy. Assuming a single broadcast duration of 5 seconds, the timeout of the offline detection timer is greater than 10 seconds at this time.
The event that the terminal device completes broadcasting the own device information to the outside includes at least two cases: the central node performs the event of actively broadcasting the self equipment information outwards, and the edge node performs the following broadcasting event to broadcast the self equipment information outwards.
S402, when the offline detection timer reaches the timeout time, the terminal equipment traverses the equipment information of all the terminal equipment except the terminal equipment in the local group, and the time difference between the latest equipment information updating time and the current time of all the terminal equipment is determined.
S403, marking the terminal equipment with the time difference larger than the pre-offline threshold as a pre-offline state, sending a unicast confirmation message to the terminal equipment in the pre-offline state, and starting a timeout timer.
When the off-line detection timer reaches the timeout time, the terminal equipment starts off-line detection of all the terminal equipment except the terminal equipment in the local group. First, the difference between the latest updated time stamp and the current time error of each piece of equipment information is checked to determine the time difference between the latest primary equipment information updating time and the current time of each piece of terminal equipment. For convenience of explanation, a terminal device to be checked for a time difference will be referred to as a device to be detected hereinafter.
When the time difference of the device to be detected is large, it is indicated that it has not communicated with the terminal device as the execution subject for a long time, there is a high possibility that it is offline, or that there is no communication success between the two due to factors other than offline. For example, it may be that the terminal device cannot receive the broadcast of the device to be detected on a probabilistic basis. Therefore, the embodiment of the application can determine the devices to be detected with large time differences and mark the devices to be detected as a pre-offline state for subsequent operation. And a timeout timer is started, and the timeout timer is used for assisting in judging whether the equipment to be detected is offline or not. The embodiment of the application does not limit the overtime time of the overtime timer excessively, and can be set by a technician. For example, it may be set to any one of 1 second to 10 seconds.
In the embodiment of the application, a pre-offline threshold is utilized to distinguish whether the time difference is large. When the time difference is greater than the pre-offline threshold, then it may be determined to be greater. Wherein, after the central node starts broadcasting, the edge node delays the broadcasting for one unit of broadcasting duration at the latest. After the edge node follows the broadcast transmission, other edge nodes will delay the broadcast reception for one unit of broadcast duration at the latest. It may be delayed by two units of duration for a single edge node to receive the device information of the other edge nodes. Based on this, and consideration of the offline detection timer timeout in S401. In the embodiment of the application, a pre-offline threshold TPreOffline is set to be more than or equal to 2duration BC+T2, wherein T2 is the timeout time of an offline detection timer, and DurationBC is the duration of single external broadcasting of the terminal equipment. When the pre-offline threshold value meets the range value, for the equipment to be detected in the normal online state, the broadcasted equipment information of the equipment to be detected can be normally received by any terminal equipment in the local group within the pre-offline threshold value. Therefore, when the time difference of the equipment to be detected is larger than the pre-offline threshold, if no interference factors other than offline exist between the equipment to be detected and the terminal equipment serving as the execution main body, so that the equipment to be detected is not successfully communicated, the equipment to be detected is indicated to be offline with a high probability.
In order to confirm the problem of the pre-offline state of the device to be detected. In the embodiment of the application, the terminal device serving as the execution subject actively sends a confirmation message to the device to be detected in the pre-offline state so as to confirm the actual online state of the device to be detected in the pre-offline state. In this case, the terminal device has not normally received the broadcast of the device to be detected in the offline state, and therefore, if the terminal device continues to send the acknowledgement message to the device to be detected in the offline state in the form of the broadcast. Even if the device to be detected in the offline state is normally on line, a message returned by the device to be detected in the offline state is possibly received. Therefore, the embodiment of the application adopts a unicast mode to send the confirmation message to the device to be detected in the offline state, so as to improve the reliability of the whole offline confirmation process.
S404, if the unicast response message returned by the terminal equipment in the pre-offline state is received before the timeout timer reaches the timeout time, the pre-offline state mark of the terminal equipment is canceled.
And S405, if the unicast response message returned by the terminal equipment in the pre-offline state is not received before the timeout timer reaches the timeout time, removing the terminal equipment in the pre-offline state from the local group.
In the embodiment of the application, when the terminal equipment receives the unicast confirmation message, the terminal equipment is set to reply a response message in a unicast mode in time. Therefore, if the unicast response message of the device to be detected in the pre-offline state is received before the timeout timer reaches the timeout time, it is indicated that the device to be detected in the pre-offline state is actually normally online. The pre-offline state flag for the device to be detected may be canceled at this time. If the unicast response message of the device to be detected in the offline state is not received before the timeout timer reaches the timeout time. It is indicated that the pre-offline state of the device to be detected is offline with a high probability. Therefore, at this time, the embodiment of the application determines that the device to be detected in the pre-offline state is offline, and removes the device to be detected in the pre-offline state from the local group at the same time, and updates the local group data in time.
As an alternative embodiment of the present application, to maintain the validity of local group data. In the embodiment of the application, if any terminal equipment receives the unicast acknowledgement message sent by other terminal equipment. On the one hand, a unicast response message is replied, and on the other hand, the local group is updated to reselect the central node.
As another alternative embodiment of the present application, to maintain the validity of local group data. In the embodiment of the application, the triggering condition of the terminal equipment for updating the local group comprises the following steps: detecting the joining of a new device to a local group, the updating of the device status of any terminal device within the local group, and the removal of the terminal device from the local group. When any trigger condition is detected, the terminal device serving as the execution subject in the embodiment of the present application determines that: the local group needs to be updated. At this time, the terminal device reselects the central node and updates the networking. Specifically, the terminal device updates the local group based on the acquired latest device information, and determines the terminal device serving as the central node in the local group according to the device score recorded in the local group. Accordingly, at this time, S405 may further include: s406.
And S406, the terminal equipment updates the local group based on the acquired latest equipment information, and determines the terminal equipment serving as a central node in the local group according to the equipment score recorded in the local group.
If the device information in the local group is the latest at this time, the terminal device serving as the central node in the local group may be determined by executing the device score recorded in the local group without updating the device information in the local group.
As an alternative embodiment of the present application, considering the specificity of the central node, when the central node goes offline, it can have a great impact on the entire local group. The embodiment of the application provides an online heartbeat detection scheme aiming at a central node. The offline discovery of the central node is timely, and is detailed as follows:
s501, when receiving the device information broadcast by the central node, the edge node starts an edge timer.
S502, if the edge node receives the device information re-broadcast by the center node before the edge timer reaches the timeout, the edge timer is reset.
If the edge timer reaches the timeout time, the edge node broadcasts the device information including the own device score.
In the embodiment of the application, the edge node starts an edge timer while executing the following broadcast event. The edge timer is used for assisting in judging the online condition of the central node. Consider that the central node actively broadcasts outside in a lead period, and the duration of each broadcast is one unit of duration. Therefore, in the embodiment of the application, the timeout time T3 of the edge timer is set to be greater than or equal to t1+ DurationBC, wherein T1 is the duration corresponding to the lead period, and DurationBC is the duration of single-time outbound broadcasting of the central node. To prevent premature detection of equipment off-line inaccuracy. Assuming a single broadcast duration of 5 seconds, the timeout of the offline detection timer is greater than 10 seconds at this time.
If the edge node receives the device information broadcast by the central node again before the edge timer reaches the timeout time, the central node is in a normal on-line leading broadcast state. At this time, the edge node resets the edge timer and starts the next detection.
If the device information broadcast by the central node is not received when the edge timer reaches the timeout time, the situation that the central node is abnormal or the communication between the edge node and the central node is abnormal may be indicated. At this time, the edge node actively broadcasts its own device information. On the one hand, the self-equipment information can be actively informed to other terminal equipment under the condition that the central node is not led, so that the other terminal equipment can still find the edge node. The influence caused by the abnormality of the central node is reduced, and the effect of equipment discovery is maintained. On the other hand, in the embodiment of the present application, the event that the terminal device completes the external broadcasting of the own device information in S401 includes at least three cases: the central node performs the event of actively broadcasting the self-equipment information outwards, the edge node performs the event of following the broadcasting event to broadcast the self-equipment information outwards, and the edge node performs the event of actively broadcasting the self-equipment information outwards. That is, in the embodiment of the present application, for the edge node, whether the external broadcasting of the self device information is completed actively or passively, the external broadcasting of the self device information is regarded as an event. Thus, when the edge timer reaches the timeout period in S503, the edge node broadcasts the device information including its own device score. The operations of S401 to S406 may be continuously triggered. Therefore, the off-line effective detection of the central node and the timely update of the local group are realized. When a problem occurs in the central node, the problem can be actively found at the first time, and a new central node is reselected.
In the embodiment of the application, the terminal equipment in the local group can actively and timely discover the terminal equipment with problems and detect whether the terminal equipment with problems is offline. And meanwhile, when the fact that the terminal equipment is offline is determined, the local group data is maintained at the first time, the central node is reselected, and the networking is realized. Therefore, the embodiment of the application can realize the timely discovery of the abnormal condition of the terminal equipment. Even if the central node or the edge node is abnormal, the embodiment of the application can rapidly reselect a new central node according to the actual situation to realize the networking again. Therefore, the fault tolerance rate to external factors is extremely high, the method can adapt to the influence of different external factors, and has extremely high adaptability and fault tolerance.
And application scene IV: and when the terminal equipment performs equipment state switching, maintaining the local group data.
In the embodiment of the application, the states of the terminal equipment are divided into an awake state and a sleep state. The terminal equipment in the wake-up state can normally communicate with other terminal equipment. Such as broadcasting messages outwards, receiving messages broadcast by other terminal devices, responding to received messages, and the like. The terminal equipment in the dormant state has high requirement on energy consumption, and the response mechanism comprises a response period. Before the response period is not reached, the terminal equipment in the dormant state does not receive the messages broadcast by other terminal equipment. When the response period is reached, there is a short response time (also referred to as a response window) within which communications with other terminal devices can be normally performed to achieve a unified response to the required processing event. After the completion of the response event processing, the terminal device may again sleep. For illustration, an example is given in which the response period is 5 minutes. The terminal device in the sleep state will wake up briefly every 5 minutes. During the 5 minutes of sleep not awakening, the terminal device does not receive messages broadcast by other terminal devices. A short response window is opened after the terminal device wakes up, during which communication with other terminal devices can be performed normally. Such as broadcast messages, messages broadcast by other terminal devices, responses to received messages, and the like. The first application scenario to the third application scenario are all schemes such as device discovery and offline detection for terminal devices in an awake state.
As an optional embodiment of the present application, it may be configured that the terminal device automatically enters a sleep state under the condition of uncharged and locked screen, so as to reduce the energy consumption of the terminal device.
From the above description, it is known that, since the response window of the terminal device in the sleep state is shorter, it is more difficult for the terminal device in the awake state to find the terminal device in the sleep state. And the terminal devices in the dormant state are more difficult to discover each other.
Meanwhile, for the terminal device, part or all of the communication modes of the terminal device can be actively opened or closed (i.e. part or all of the communication channels of the terminal device are opened or closed). For example, bluetooth and WiFi functions may be selected to be turned on simultaneously, or only one of the communication modes may be selected to be turned on. For another example, in a state where both bluetooth and WiFi are on, one or all of the communication modes are selected to be off. Aiming at the condition that a certain communication mode is closed, the terminal equipment cannot find equipment and service operation by using the communication mode. When a certain communication mode is opened, the terminal device can be found by other terminal devices on the communication mode, and can perform service operation through the communication mode.
Aiming at the situations of the dormancy and the switching communication mode of the terminal equipment, in the embodiment of the application, the terminal equipment can perform any operation of the following operations:
1. and when the state switching occurs, the terminal equipment broadcasts the real-time state of the terminal equipment.
The state switching includes the following cases:
a. The terminal device switches from the awake state to the sleep state. b. The terminal device switches from the sleep state to the awake state. c. The terminal device opens a certain communication mode. At this time, the information that the communication mode is started can be broadcast outwards through the started communication mode.
In the embodiment of the application, the terminal equipment actively informs the real-time state of other terminal equipment, so that the equipment discovery between the terminal equipment is more efficient. The active external broadcasting at this time is independent of the external broadcasting in the embodiments of the application scene one to the application scene three, and the broadcasting content is not the device information, but the real-time state of the terminal device.
2. And when the terminal equipment enters the dormant state, removing all the terminal equipment in the dormant state in the local group.
Since the terminal devices in the sleep state are difficult to find each other, they can be removed from each other, so as to reduce the workload when the terminal devices in the sleep state find each other.
3. And when the terminal equipment closes a certain communication mode, removing all the terminal equipment in the local group associated with the communication mode.
Closing the communication means may result in the terminal device not being able to use the communication means to discover the device and the service operation. Therefore, the local ungrouping data of the communication mode is cleared in time, the data generated in the equipment discovery process can be reduced, and the storage is saved.
Application scenario five: terminal equipment in a dormant state maintains networking.
Since the terminal device in the sleep state needs to perform event response in the response window period. Therefore, the terminal equipment in the dormant state is difficult to discover by using the equipment discovery modes of the first application scene and the second application scene. Meanwhile, when the terminal equipment in the dormant state is found, if the offline detection mode of the third application scenario is used, the terminal equipment in the dormant state is easily judged to be offline equipment, and the local group is removed. It is possible that a terminal device considering a sleep state may interact with other terminal devices to perform some business operations, although it is difficult for the device to discover. If the service has a corresponding active wake-up mechanism, wake-up the terminal device in the dormant state in a unicast mode or the like, the terminal device in the dormant state can perform service interaction with other terminal devices. The embodiment of the application provides a scheme suitable for the discovery of the sleep state maintenance equipment. The terminal device in the sleep state is hereinafter referred to as a sleep device, and the terminal device in the awake state is referred to as an awake device. Referring to fig. 5, the details are as follows:
s601, the terminal equipment in the dormant state broadcasts equipment information with own equipment score during a response window.
In the embodiment of the application, the dormant device starts a response window after reaching a response period, and actively broadcasts own device information outwards during the response window starting period. Wherein the specific value of the response window is not limited herein and can be determined by a person at his own discretion. In addition, the device score calculation methods of the sleep device and the wake-up device are the same, so specific calculation methods, calculation timing, and the like can refer to the related descriptions in the first application scenario and the second application scenario, which are not described herein.
S602, when receiving the device information broadcast by the terminal device in the sleep state, the terminal device in the wake state broadcasts the device information with the own device score to the outside.
For a wake-up device, upon receiving a broadcast from a hibernating device, a broadcast of device information with its own device score is looped back for the device information. The broadcast of the wake-up device is an instant broadcast and can be independent of the broadcast operation in the application scenario one to the application scenario three. So that the sleeping device can perceive the individual wake-up devices during the response window. For example, for a central node, an immediate broadcast may be looped back separately from the lead period broadcast at this time. For the edge node, an immediate broadcast may be looped back separately from the following broadcast and the broadcast of the on-line heartbeat detection to the central node.
The wake-up device may determine the device status of the transmitting end of the device information by analyzing the device score in the device information, so as to determine whether the transmitting end is a sleep device.
And S603, the terminal equipment in the dormant state receives the equipment information broadcast by other terminal equipment and records the equipment information to the local group.
As an alternative embodiment of the present application, for a sleep device, the device information received during the response window may be regarded as a wake-up device at the sending end of the device information. In another alternative embodiment of the present application, the device state of the transmitting end of the device information may be determined by analyzing the device score in the device information, so as to determine whether the transmitting end is a wake-up device.
As an alternative embodiment of the present application. Considering the specificity of the response mechanism of the sleep device, if the sleep device is used as a central node, the lead period needs to be the same as or an integer multiple of the response period of the sleep device. Whereas in practical applications the response period of the hibernating device is often longer. This results in less efficient discovery of the entire local group device. While having at least one communication due to the wake-up device and the sleep device.
Therefore, in the embodiment of the application, for the dormant device, after receiving the device information broadcast by other terminal devices, the device information in the local group is updated. The center node selection may be selected at this time, or not performed. For wake-up devices, the device information within the local group is updated upon receiving the device information broadcast by the hibernating device. At this point, the center node may be selected for reselection or not updated.
Meanwhile, for offline detection in the third application scenario, the timeout time of the timeout timer corresponding to the hibernation device may be set to be equal to the duration corresponding to the response period of the hibernation device. For example, assume that the response period on the sleep side is 5 minutes, while the timeout duration of the timeout timer is set to 5 minutes. And if the device information broadcast by the dormant device is not received within 5 minutes, treating the dormant device as a pre-offline state, and carrying out unicast confirmation. And in particular with reference to the embodiment shown in fig. 4.
In the embodiment of the application, the device information is actively broadcasted by multiplexing the response window period of the sleep device, so that the mutual discovery between the sleep device and the wake-up device is realized. Meanwhile, the multiplexing response window does not additionally trigger the awakening of the dormant device, so that the awakening times of the dormant device are not increased by the device discovery, and the energy consumption of the dormant device in the process of device discovery is greatly reduced.
As an alternative embodiment of the present application, broadcast events can be divided into two categories: forced broadcast events and non-forced broadcast events. Wherein, when the forced broadcast event is triggered, the terminal device will forcedly respond to and execute the corresponding broadcast event. When an optional broadcast event is triggered, the terminal device checks the time interval between the current broadcast event and the previous broadcast event. If the time interval is too short, and the terminal device has not performed the previous broadcast event (i.e. is still in broadcast), the broadcast event is abandoned. Wherein, whether the interval is too long can be divided by setting the interval threshold. The time interval phrase interval threshold may then determine that the time interval is too short. The value of the interval threshold may be less than or equal to the duration of a single broadcast by the terminal device.
Fig. 6 shows a schematic structural diagram of a device discovery apparatus according to an embodiment of the present application, corresponding to the device discovery method described in the foregoing embodiment, and for convenience of explanation, only a portion related to the embodiment of the present application is shown.
Referring to fig. 6, the device discovery apparatus includes:
A broadcasting module 61, configured to broadcast, for the outside, target device information of the target device, where the target device information includes a device score of the target device.
The receiving module 62 is configured to receive first device information broadcast by a first terminal device, where the first device information includes a device score of the first terminal device, and the first terminal device is a terminal device other than the target device.
The updating module 63 is configured to update the local group of the target device based on the target device information and/or the first device information. The local group is recorded with at least one second terminal device and second device information of the second terminal device, each second device information comprises a device score of the corresponding second terminal device, and at least one second terminal device comprises a target device.
And an election module 64, configured to determine, from the updated local group, a terminal device serving as a central node based on the device score in the updated local group, and obtain a service network centered on the central node.
As an alternative embodiment of the application, the local group comprises a second terminal device as a central node and a number of second terminal devices as edge nodes other than the central node.
When the target device is a central node, the broadcasting module 61 is specifically configured to:
and according to a preset leading period, broadcasting the target equipment information of the target equipment to the outside periodically. The target device information is used for indicating the edge node, and when the target device information is received, second device information of the edge node is broadcasted outwards.
When the target device is an edge node, the broadcasting module 61 and the receiving module 62 include:
A receiving module 62, configured to receive first device information broadcasted by the first terminal device.
A broadcasting module 61, configured to perform an operation of broadcasting the target device information of the target device to the outside when the received first device information includes the device information broadcasted by the central node. The equipment information of the central node is periodically broadcast outwards by the central node according to a preset leading period.
As an alternative embodiment of the present application, the updating module 63 is specifically configured to:
and determining the terminal equipment which is not recorded in the local group and is contained in the first terminal equipment based on the first equipment information.
And recording the device information broadcast by the terminal devices which are not recorded in the local group in the first device information into the local group so as to update the local group.
As an alternative embodiment of the present application, the updating module 63 is specifically configured to:
And determining second terminal equipment with equipment score needing to be updated in the local group based on the target equipment information and/or the first equipment information, and updating the equipment score of the determined second terminal equipment so as to update the local group.
As an alternative embodiment of the application, the device score of any terminal device is inversely related to the energy consumption sensitivity of that terminal device.
The election module 64 is specifically configured to: and taking the terminal equipment with the highest equipment score in the updated local group as a central node.
As an alternative embodiment of the present application, the device discovery apparatus further includes:
and the off-line detection module is used for off-line detection of each second terminal device in the local group.
And the offline updating module is used for removing the offline second terminal equipment determined by offline detection from the local group so as to update the local group.
As an alternative embodiment of the present application, the offline detection module is specifically configured to:
and starting an offline detection timer after finishing the operation of broadcasting the target device information of the target device.
And when the offline detection timer reaches the corresponding timeout time, screening out second terminal equipment with the time difference between the equipment information updating time and the current time being larger than a preset offline threshold from the second terminal equipment recorded in the local group.
And respectively sending unicast acknowledgement messages to the screened second terminal equipment, and starting a timeout timer.
And when the timeout timer reaches the corresponding timeout time, judging the terminal equipment which does not receive the return unicast response message aiming at the unicast confirmation message in the screened second terminal equipment as the offline terminal equipment.
As an alternative embodiment of the present application, the device discovery apparatus further includes:
And the dormancy detection module is used for detecting whether the first terminal equipment comprises the terminal equipment in the dormancy state according to the received first equipment information.
And the dormancy response module is used for broadcasting the target equipment information of the target equipment outwards when the first terminal equipment comprises the terminal equipment in the dormancy state and the target equipment does not broadcast the target equipment information of the target equipment currently. The first device information of the terminal device in the dormant state is broadcast by the terminal device in the dormant state during the period that the terminal device is in the response window.
The process of implementing respective functions by each module in the device discovery apparatus provided in the embodiment of the present application may refer specifically to the foregoing descriptions of the embodiments shown in fig. 1 to 5 and other related method embodiments, which are not described herein again.
It should be noted that, because the content of information interaction and execution process between the above devices/units is based on the same concept as the method embodiment of the present application, specific functions and technical effects thereof may be referred to in the method embodiment section, and will not be described herein.
It should be understood that the sequence number of each step in the foregoing embodiment does not mean that the execution sequence of each process should be determined by the function and the internal logic, and should not limit the implementation process of the embodiment of the present application.
It should be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It should also be understood that the term "and/or" as used in the present specification and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes such combinations.
As used in the present description and the appended claims, the term "if" may be interpreted as "when..once" or "in response to a determination" or "in response to detection" depending on the context. Similarly, the phrase "if a determination" or "if a [ described condition or event ] is detected" may be interpreted in the context of meaning "upon determination" or "in response to determination" or "upon detection of a [ described condition or event ]" or "in response to detection of a [ described condition or event ]".
Furthermore, the terms "first," "second," "third," and the like in the description of the present specification and in the appended claims, are used for distinguishing between descriptions and not necessarily for indicating or implying a relative importance. It will also be understood that, although the terms "first," "second," etc. may be used herein in some embodiments of the application to describe various elements, these elements should not be limited by these terms. These terms are only used to distinguish one element from another element. For example, a first table may be named a second table, and similarly, a second table may be named a first table without departing from the scope of the various described embodiments. The first table and the second table are both tables, but they are not the same table.
Reference in the specification to "one embodiment" or "some embodiments" or the like means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," and the like in the specification are not necessarily all referring to the same embodiment, but mean "one or more but not all embodiments" unless expressly specified otherwise. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless expressly specified otherwise.
The device discovery method provided by the embodiment of the application can be applied to terminal devices such as mobile phones, tablet computers, wearable devices, vehicle-mounted devices, augmented reality (augmented reality, AR)/Virtual Reality (VR) devices, notebook computers, ultra-mobile personal computer (UMPC), netbooks, personal digital assistants (personal DIGITAL ASSISTANT, PDA) and the like, and the embodiment of the application does not limit the specific types of the terminal devices.
For example, the terminal device may be a Station (ST) in a WLAN, a cellular telephone, a cordless telephone, a session initiation protocol (session InitiationProtocol, SIP) telephone, a wireless local loop (Wireless Local Loop, WLL) station, a personal digital assistant (personal DIGITAL ASSISTANT, PDA) device, a handheld device with wireless communication capabilities, a computing device or other processing device connected to a wireless modem, an in-vehicle device, a car networking terminal, a computer, a laptop computer, a handheld communication device, a handheld computing device, a satellite radio, a wireless modem card, a television Set Top Box (STB), a customer premise equipment (customer premise equipment, CPE) and/or other devices for communication over a wireless system as well as next generation communication systems, such as a terminal device in a 5G network or a terminal device in a future evolved public land mobile network (Public Land Mobile Network, PLMN) network, etc.
By way of example, but not limitation, when the terminal device is a wearable device, the wearable device may also be a generic name for applying wearable technology to intelligently design daily wear, developing wearable devices, such as glasses, gloves, watches, apparel, shoes, and the like. The wearable device is a portable device that is worn directly on the body or integrated into the clothing or accessories of the user. The wearable device is not only a hardware device, but also can realize a powerful function through software support, data interaction and cloud interaction. The generalized wearable intelligent device comprises full functions, large size, and complete or partial functions which can be realized independent of a smart phone, such as a smart watch or a smart glasses, and is only focused on certain application functions, and needs to be matched with other devices such as the smart phone for use, such as various smart bracelets, smart jewelry and the like for physical sign monitoring.
Fig. 7 is a schematic structural diagram of a terminal device according to an embodiment of the present application. As shown in fig. 7, the terminal device 7 of this embodiment includes: at least one processor 70 (only one shown in fig. 7), a memory 71, said memory 71 having stored therein a computer program 72 executable on said processor 70. The processor 70, when executing the computer program 72, implements the steps of the various device discovery method embodiments described above, such as steps S301 'to S305' shown in fig. 3A. Or the processor 70, when executing the computer program 72, performs the functions of the modules/units of the apparatus embodiments described above, such as the functions of the modules 61-64 shown in fig. 6.
The terminal device 7 may be a computing device such as a desktop computer, a notebook computer, a palm computer, a cloud server, etc. The terminal device may include, but is not limited to, a processor 70, a memory 71. It will be appreciated by those skilled in the art that fig. 7 is merely an example of the terminal device 7 and does not constitute a limitation of the terminal device 7, and may include more or less components than illustrated, or may combine certain components, or different components, e.g., the terminal device may further include an input transmitting device, a network access device, a bus, etc.
The processor 70 may be a central processing unit (Central Processing Unit, CPU), or may be another general purpose processor, a digital signal processor (DIGITAL SIGNAL processor, DSP), an Application SPECIFIC INTEGRATED Circuit (ASIC), an off-the-shelf programmable gate array (field-programmable GATE ARRAY, FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 71 may in some embodiments be an internal storage unit of the terminal device 7, such as a hard disk or a memory of the terminal device 7. The memory 71 may be an external storage device of the terminal device 7, such as a plug-in hard disk, a smart memory card (SMART MEDIA CARD, SMC), a Secure Digital (SD) card, a flash memory card (FLASH CARD) or the like, which are provided on the terminal device 7. Further, the memory 71 may also include both an internal storage unit and an external storage device of the terminal device 7. The memory 71 is used for storing an operating system, application programs, boot loader (BootLoader), data, other programs, etc., such as program codes of the computer program. The memory 71 may also be used for temporarily storing data that has been transmitted or is to be transmitted.
In the following, taking a mobile phone as an example of the terminal device, fig. 8 shows a schematic structural diagram of the mobile phone 100.
The handset 100 may include A processor 110, an external memory interface 120, an internal memory 121, A universal serial bus (universal serial bus, USB) interface 130, A charge management module 140, A power management module 141, A battery 142, an antenna 1, an antenna 2, A mobile communication module 150, A wireless communication module 160, an audio module 170, A speaker 170A, A receiver 170B, A microphone 170C, an earphone interface 170D, A sensor module 180, keys 190, A motor 191, an indicator 192, A camera 193, A display 194, and A SIM card interface 195, etc. The sensor module 180 may include a gyroscope sensor 180A, an acceleration sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an ambient light sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, and a touch sensor 180K (of course, the mobile phone 100 may also include other sensors such as a temperature sensor, a pressure sensor, an air pressure sensor, a bone conduction sensor, etc., which are not shown).
The wireless communication function of the mobile phone 100 may be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, a modem processor, a baseband processor, and the like.
The antennas 1 and 2 are used for transmitting and receiving electromagnetic wave signals. Each antenna in the handset 100 may be used to cover a single or multiple communication bands. Different antennas may also be multiplexed to improve the utilization of the antennas. For example: the antenna 1 may be multiplexed into a diversity antenna of a wireless local area network. In other embodiments, the antenna may be used in conjunction with a tuning switch.
The mobile communication module 150 may provide a solution for wireless communication including 2G/3G/4G/5G, etc. applied to the handset 100. The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (low noise amplifier, LNA), etc. The mobile communication module 150 may receive electromagnetic waves from the antenna 1, perform processes such as filtering, amplifying, and the like on the received electromagnetic waves, and transmit the processed electromagnetic waves to the modem processor for demodulation. The mobile communication module 150 can amplify the signal modulated by the modem processor, and convert the signal into electromagnetic waves through the antenna 1 to radiate. In some embodiments, at least some of the functional modules of the mobile communication module 150 may be disposed in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 may be provided in the same device as at least some of the modules of the processor 110.
The modem processor may include a modulator and a demodulator. The modulator is used for modulating the low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used for demodulating the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low frequency baseband signal to the baseband processor for processing. The low frequency baseband signal is processed by the baseband processor and then transferred to the application processor. The application processor outputs sound signals through an audio device (not limited to the speaker 170A, the receiver 170B, etc.), or displays images or video through the display screen 194. In some embodiments, the modem processor may be a stand-alone device. In other embodiments, the modem processor may be provided in the same device as the mobile communication module 150 or other functional module, independent of the processor 110.
The wireless communication module 160 may provide solutions for wireless communication including wireless local area network (wireless local area networks, WLAN) (e.g., wireless fidelity (WIRELESS FIDELITY, wi-Fi) network), bluetooth (BT), global navigation satellite system (global navigation SATELLITE SYSTEM, GNSS), frequency modulation (frequency modulation, FM), near field communication (NEAR FIELD communication, NFC), infrared (IR), etc., applied to the mobile phone 100. The wireless communication module 160 may be one or more devices that integrate at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the electromagnetic wave signals, filters the electromagnetic wave signals, and transmits the processed signals to the processor 110. The wireless communication module 160 may also receive a signal to be transmitted from the processor 110, frequency modulate it, amplify it, and convert it to electromagnetic waves for radiation via the antenna 2. In an embodiment of the present application, the wireless communication module 160 may be configured to access an access point device, and send and receive messages to other terminal devices. In the embodiment of the present application, the mobile communication module 160 may also be used to interact with other terminal devices, that is, broadcast device information to other terminal devices, or the mobile communication module 160 may be used to receive device information broadcast by other terminal devices, and package the received device information into a message in a specified format.
It should be understood that in practical applications, the mobile phone 100 may include more or fewer components than shown in fig. 8, and embodiments of the present application are not limited. The illustrated handset 100 is only one example, and the handset 100 may have more or fewer components than shown in the figures, may combine two or more components, or may have a different configuration of components. The various components shown in the figures may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and/or application specific integrated circuits.
The software system of the terminal device can adopt a layered architecture, an event driven architecture, a microkernel architecture, a microservice architecture or a cloud architecture. In the embodiment of the invention, an Android system with a layered architecture is taken as an example, and the software structure of terminal equipment is illustrated. Fig. 9 is a software configuration block diagram of a terminal device according to an embodiment of the present invention.
The layered architecture divides the software into several layers, each with distinct roles and branches. The layers communicate with each other through a software interface. In some embodiments, the Android system is divided into four layers, from top to bottom, an application layer, an application framework layer, an Zhuoyun rows (Android runtime) and system libraries, and a kernel layer, respectively.
The application layer may include a series of application packages.
As shown in fig. 9, the application package may include applications such as phone, camera, gallery, calendar, talk, map, navigation, WLAN, bluetooth, music, video, short message, etc.
The application framework layer provides an application programming interface (application programming interface, API) and programming framework for the application of the application layer. The application framework layer includes a number of predefined functions.
As shown in fig. 9, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, and the like.
The window manager is used for managing window programs. The window manager can acquire the size of the display screen, judge whether a status bar exists, lock the screen, intercept the screen and the like.
The content provider is used to store and retrieve data and make such data accessible to applications. The data may include video, images, audio, calls made and received, browsing history and bookmarks, phonebooks, etc.
The view system includes visual controls, such as controls to display text, controls to display pictures, and the like. The view system may be used to build applications. The display interface may be composed of one or more views. For example, a display interface including a text message notification icon may include a view displaying text and a view displaying a picture.
The telephony manager is arranged to provide communication functions for the terminal device. Such as the management of call status (including on, hung-up, etc.).
The resource manager provides various resources for the application program, such as localization strings, icons, pictures, layout files, video files, and the like.
The notification manager allows the application to display notification information in a status bar, can be used to communicate notification type messages, can automatically disappear after a short dwell, and does not require user interaction. Such as notification manager is used to inform that the download is complete, message alerts, etc. The notification manager may also be a notification in the form of a chart or scroll bar text that appears on the system top status bar, such as a notification of a background running application, or a notification that appears on the screen in the form of a dialog window. For example, a text message is prompted in a status bar, a prompt tone is emitted, the terminal equipment vibrates, and an indicator light blinks.
Android run time includes a core library and virtual machines. Android runtime is responsible for scheduling and management of the android system.
The core library consists of two parts: one part is a function which needs to be called by java language, and the other part is a core library of android.
The application layer and the application framework layer run in a virtual machine. The virtual machine executes java files of the application program layer and the application program framework layer as binary files. The virtual machine is used for executing the functions of object life cycle management, stack management, thread management, security and exception management, garbage collection and the like.
The system library may include a plurality of functional modules. For example: surface manager (surface manager), media Libraries (Media Libraries), three-dimensional graphics processing Libraries (e.g., openGL ES), 2D graphics engines (e.g., SGL), etc.
The surface manager is used to manage the display subsystem and provides a fusion of 2D and 3D layers for multiple applications.
Media libraries support a variety of commonly used audio, video format playback and recording, still image files, and the like. The media library may support a variety of audio video encoding formats, such as: MPEG4, h.164, MP3, AAC, AMR, JPG, PNG, etc.
The three-dimensional graphic processing library is used for realizing three-dimensional graphic drawing, image rendering, synthesis, layer processing and the like.
The 2D graphics engine is a drawing engine for 2D drawing.
The kernel layer is a layer between hardware and software. The inner core layer at least comprises a display driver, a camera driver, an audio driver and a sensor driver.
In addition, it will be clearly understood by those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional units and modules is illustrated, and in practical application, the above-described functional allocation may be performed by different functional units and modules according to needs, i.e. the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-described functions. The functional units in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The embodiment of the application also provides a terminal device, which comprises at least one memory, at least one processor and a computer program stored in the at least one memory and capable of running on the at least one processor, wherein the processor executes the computer program to enable the terminal device to realize the steps in any of the method embodiments.
Embodiments of the present application also provide a computer readable storage medium storing a computer program which, when executed by a processor, implements steps for implementing the various method embodiments described above.
The embodiments of the present application provide a computer program product enabling a terminal device to carry out the steps of the method embodiments described above when the computer program product is run on the terminal device.
The embodiment of the application also provides a chip system, which comprises a processor, wherein the processor is coupled with a memory, and the processor executes a computer program stored in the memory to realize the steps in the embodiments of the method.
The integrated modules/units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the present application may implement all or part of the flow of the method of the above embodiment, or may be implemented by a computer program to instruct related hardware, where the computer program may be stored in a computer readable storage medium, and when the computer program is executed by a processor, the computer program may implement the steps of each of the method embodiments described above. Wherein the computer program comprises computer program code which may be in source code form, object code form, executable file or some intermediate form etc. The computer readable storage medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM), a random access memory (Random Access Memory, RAM), an electrical carrier signal, a telecommunications signal, a software distribution medium, and so forth.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and in part, not described or illustrated in any particular embodiment, reference is made to the related descriptions of other embodiments.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
The above embodiments are only for illustrating the technical solution of the present application, and not for limiting the same; although the application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present application, and are intended to be included in the scope of the present application.

Claims (9)

1. A device discovery method, applied to a target device, the method comprising:
Broadcasting target equipment information of the target equipment to the outside, wherein the target equipment information comprises equipment scores of the target equipment;
Receiving first equipment information broadcast by first terminal equipment, wherein the first equipment information comprises equipment scores of the first terminal equipment, and the first terminal equipment is other than the target equipment; the method comprises the steps of respectively selecting the charging states, screen unlocking states, whether WLAN is supported, whether BLE is supported and the battery state of charge of target equipment and first terminal equipment, and respectively taking the charging states, the screen unlocking states, whether WLAN is supported, whether BLE is supported and the battery state of charge as equipment state contents according to scoring of the target equipment and the first terminal equipment;
Updating the local group of the target device based on the target device information and/or the first device information, including: determining unrecorded terminal equipment in the local group contained in the first terminal equipment based on the first equipment information; recording the equipment information broadcast by the terminal equipment which is not recorded in the local group in the first equipment information into the local group so as to update the local group; or based on the target equipment information and/or the first equipment information, determining second terminal equipment of which the equipment score in the local group needs to be updated, and updating the equipment score of the determined second terminal equipment so as to update the local group; the local group is recorded with at least one second terminal device and second device information of the second terminal device, each second device information comprises a device score corresponding to the second terminal device, and the at least one second terminal device comprises the target device;
And determining terminal equipment serving as a center node from the updated local group based on the updated equipment score in the local group to obtain a service network centering on the center node.
2. The device discovery method according to claim 1, wherein the local group includes one of the second terminal devices as the center node and a plurality of the second terminal devices as edge nodes other than the center node;
When the target device is the central node, the broadcasting the target device information of the target device to the outside includes:
According to a preset leading period, broadcasting the target equipment information of the target equipment to the outside periodically; the target equipment information is used for indicating the edge node, and when the target equipment information is received, the second equipment information of the edge node is broadcasted outwards;
When the target device is the edge node, broadcasting target device information of the target device to the outside; receiving first device information broadcast by a first terminal device, including:
receiving the first equipment information broadcasted by the first terminal equipment;
When the received first device information contains the device information broadcasted by the central node, executing the operation of broadcasting the target device information of the target device outwards; the equipment information of the central node is broadcasted periodically outwards by the central node according to a preset leading period.
3. The device discovery method of claim 1, wherein the device score of any terminal device is inversely related to the energy consumption sensitivity of the terminal device;
The determining, based on the updated device score in the local group, a terminal device serving as a central node from the updated local group includes:
and taking the terminal equipment with the highest equipment score in the updated local group as the central node.
4. A device discovery method according to any one of claims 1 to 3, further comprising, before said determining a terminal device as a central node from the updated local group based on the updated device score in the local group:
performing offline detection on each second terminal device in the local group;
And removing the offline second terminal equipment determined by the offline detection from the local group so as to update the local group.
5. The device discovery method according to claim 4, wherein the performing offline detection on each of the second terminal devices in the local group includes:
after the operation of broadcasting the target equipment information of the target equipment to the outside is completed, starting an offline detection timer;
when the offline detection timer reaches the corresponding timeout time, screening out the second terminal equipment with the time difference between the equipment information updating time and the current time being greater than a preset offline threshold from the second terminal equipment recorded by the local group;
Respectively sending unicast acknowledgement messages to the screened second terminal equipment, and starting a timeout timer;
and when the timeout timer reaches the corresponding timeout time, judging that the target device does not receive the terminal device for returning the unicast response message to the unicast acknowledgement message in the screened second terminal device is an offline terminal device.
6. The device discovery method according to claim 1, further comprising, after the receiving the first device information broadcast by the first terminal device:
detecting whether the first terminal equipment comprises terminal equipment in a dormant state or not according to the received first equipment information;
When the first terminal equipment comprises terminal equipment in a dormant state and the target equipment does not broadcast the own target equipment information currently, broadcasting the target equipment information of the target equipment outwards; the first device information of the terminal device in the dormant state is broadcasted by the terminal device in the dormant state during the period that the terminal device is in the response window.
7. A terminal device, characterized in that it comprises a memory, a processor, on which a computer program is stored which is executable on the processor, the processor implementing the device discovery method according to any one of claims 1 to 6 when executing the computer program.
8. A device discovery system, comprising: a central node and a number of edge nodes, both of which are terminal devices according to claim 7.
9. A chip system comprising a processor coupled to a memory, the processor executing a computer program stored in the memory to implement the device discovery method of any one of claims 1 to 6.
CN202210609615.9A 2022-05-31 2022-05-31 Device discovery method, system, terminal device and chip system Active CN116033368B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210609615.9A CN116033368B (en) 2022-05-31 2022-05-31 Device discovery method, system, terminal device and chip system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210609615.9A CN116033368B (en) 2022-05-31 2022-05-31 Device discovery method, system, terminal device and chip system

Publications (2)

Publication Number Publication Date
CN116033368A CN116033368A (en) 2023-04-28
CN116033368B true CN116033368B (en) 2024-04-19

Family

ID=86077098

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210609615.9A Active CN116033368B (en) 2022-05-31 2022-05-31 Device discovery method, system, terminal device and chip system

Country Status (1)

Country Link
CN (1) CN116033368B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103260181A (en) * 2012-08-13 2013-08-21 中国科学技术大学苏州研究院 Service-oriented discovered mobile node group maintenance method
CN112118538A (en) * 2019-06-20 2020-12-22 青岛海信移动通信技术股份有限公司 Method and device for device information interaction between terminals
CN114448997A (en) * 2022-01-04 2022-05-06 中国人民武装警察部队工程大学 Equipment quality information management node consensus method based on PBFT

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8693453B2 (en) * 2011-12-15 2014-04-08 Microsoft Corporation Mobile node group formation and management

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103260181A (en) * 2012-08-13 2013-08-21 中国科学技术大学苏州研究院 Service-oriented discovered mobile node group maintenance method
CN112118538A (en) * 2019-06-20 2020-12-22 青岛海信移动通信技术股份有限公司 Method and device for device information interaction between terminals
CN114448997A (en) * 2022-01-04 2022-05-06 中国人民武装警察部队工程大学 Equipment quality information management node consensus method based on PBFT

Also Published As

Publication number Publication date
CN116033368A (en) 2023-04-28

Similar Documents

Publication Publication Date Title
EP4080834A1 (en) Notification processing system and method, and electronic device
CN110460981B (en) Bluetooth object searching method and electronic equipment
CN113645715B (en) Method and terminal device for monitoring link
CN111628916A (en) Method for cooperation of intelligent sound box and electronic equipment
CN110018902A (en) Internal memory processing method and device, electronic equipment, computer readable storage medium
CN114615660A (en) Access method, system and electronic equipment
CN116800301A (en) Power line communication system, method and equipment for detecting network state
CN113747416A (en) Network searching method and related device
CN113207115B (en) Mobile terminal and network searching control method
CN116033368B (en) Device discovery method, system, terminal device and chip system
CN115314427B (en) Protocol testing method, electronic equipment and chip system
CN115002747B (en) Parameter updating method, system, terminal equipment and chip system
CN116089358B (en) Data migration method and electronic equipment
CN114173286B (en) Method and device for determining test path, electronic equipment and readable storage medium
CN117425227A (en) Method and device for establishing session based on WiFi direct connection
CN107104721A (en) Information transferring method, apparatus and system
CN116033344B (en) Geofence determination method, equipment and storage medium
CN116056003B (en) Geofence triggering method and related electronic equipment
CN114173317B (en) Method for transmitting data and electronic equipment
CN115712745B (en) Method, system and electronic device for acquiring user annotation data
CN117376830B (en) Geofence matching method, electronic device and computer readable storage medium
CN116095230B (en) Application program recommendation method, terminal device and readable storage medium
CN117156597B (en) Ad hoc network-based device processing method, device and storage medium
CN116738073B (en) Method, equipment and storage medium for identifying residence
CN116033592B (en) Method and device for using cellular communication function

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant