CN117676521A - Link control method, device, main equipment and communication system - Google Patents

Link control method, device, main equipment and communication system Download PDF

Info

Publication number
CN117676521A
CN117676521A CN202211042386.3A CN202211042386A CN117676521A CN 117676521 A CN117676521 A CN 117676521A CN 202211042386 A CN202211042386 A CN 202211042386A CN 117676521 A CN117676521 A CN 117676521A
Authority
CN
China
Prior art keywords
sub
link
physical link
service
equipment
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.)
Pending
Application number
CN202211042386.3A
Other languages
Chinese (zh)
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.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies 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 Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN202211042386.3A priority Critical patent/CN117676521A/en
Publication of CN117676521A publication Critical patent/CN117676521A/en
Pending legal-status Critical Current

Links

Landscapes

  • Mobile Radio Communication Systems (AREA)

Abstract

The embodiment of the invention provides a link control method, a device, a main device and a communication system. The method comprises the following steps: responding to a received service triggering message of a first sub-device, and inquiring whether a physical link is established with the first sub-device; if no physical link is found to be established with the first sub-equipment, inquiring whether an idle link exists currently; if no idle link exists currently, selecting a physical link of the second sub-equipment from the currently established physical links according to the set link dynamic allocation rule, wherein the physical link of the second sub-equipment is a physical link conforming to the set link dynamic allocation rule; setting a physical link of the second sub-device as a virtual link; and establishing a physical link with the first sub-device. The technical scheme provided by the embodiment of the invention avoids repeatedly disconnecting and establishing the physical link, so that the time for disconnecting and establishing the physical link is optimized without modifying a protocol stack, and the universality of a link control scheme is improved.

Description

Link control method, device, main equipment and communication system
[ field of technology ]
The present invention relates to the field of communications technologies, and in particular, to a link control method, a device, a master device, and a communications system.
[ background Art ]
Along with the increasing of the living standard of people, intelligent products are more and more in recent years, the concept of whole house intelligence is rapidly popular in the life of people, and the related industry of whole house intelligence is rapidly developed. If intelligent control of the whole house intelligent product is to be realized, connection between devices is important. The low-power consumption Bluetooth (Bluetooth Low Energy, BLE) connection technology has the advantages of low power consumption, low time delay, low cost and the like, and is very suitable for being applied to the field of whole-house intelligence. So more and more manufacturers are beginning to produce BLE sub-devices for application in full house intelligence, e.g. BLE sub-devices may comprise e.g. smart toothbrushes or smart car aromatherapy etc.
To facilitate remote control of numerous BLE sub-devices, BLE gateway devices have grown. After the BLE gateway equipment adds the BLE sub-equipment, operations such as connection, disconnection, deletion and control can be performed on the BLE sub-equipment so as to realize management on the BLE sub-equipment, and the management on the BLE sub-equipment does not need to be limited in a local area network, so that a user can remotely control the BLE sub-equipment at home through a mobile phone even if the user is far away from a company.
If the BLE gateway device is to realize control over the BLE sub-device, a connection needs to be established between the BLE gateway device and the BLE sub-device, the connection is established based on a generic attribute profile (Generic Attribute Profile, GATT), and thus the established connection may be referred to as a GATT link, in other words, the GATT link needs to be established between the BLE gateway device and the BLE sub-device. However, due to the limitation of the hardware specification, the number of GATT links that can be simultaneously established by the chip of the BLE gateway device is limited, typically less than 10, so in the related art scheme, when a plurality of BLE sub-devices (for example, 20 BLE sub-devices) need to be suspended under the BLE gateway device, it is necessary to implement link control on the plurality of BLE sub-devices by repeatedly disconnecting the GATT links and establishing the GATT links and modifying the scheme of the bluetooth protocol stack, thereby resulting in poor versatility of the link control scheme for the plurality of BLE sub-devices.
[ invention ]
In view of this, the present invention provides a link control method, apparatus, master device, and communication system for improving the versatility of a link control scheme.
A first aspect provides a link control method, the method comprising:
responding to a received service triggering message of a first sub-device, and inquiring whether a physical link is established with the first sub-device;
If no physical link is found to be established with the first sub-equipment, inquiring whether an idle link exists currently;
if no idle link exists currently, selecting a physical link of the second sub-equipment from the currently established physical links according to the set link dynamic allocation rule, wherein the physical link of the second sub-equipment is a physical link conforming to the set link dynamic allocation rule;
setting a physical link of the second sub-device as a virtual link;
and establishing a physical link with the first sub-device.
In one possible implementation, the method further includes:
and if the idle link exists currently, establishing a physical link with the first sub-equipment.
In one possible implementation manner, the setting the physical link of the second sub-device as a virtual link includes:
disconnecting the physical link of the second sub-device;
and establishing the virtual link with the second sub-equipment.
In one possible implementation manner, the selecting, according to the set link dynamic allocation rule, the physical link of the second sub-device from the currently established physical links includes:
if judging that at least one priority of the service occupying the currently established physical link is lower than the priority of the service of the first sub-equipment, selecting a physical link occupied by the service with the lowest priority from the currently established physical links;
And determining the physical link occupied by the selected service with the lowest priority as the physical link of the second sub-equipment.
In one possible implementation manner, the selecting, according to the set link dynamic allocation rule, the physical link of the second sub-device from the currently established physical links includes:
if judging that the priority of the service occupying the currently established physical link is not lower than the priority of the service of the first sub-equipment, waiting for a set time period;
if judging that at least one priority of the service occupying the currently established physical link is lower than the priority of the service of the first sub-device after the set time period, selecting a physical link occupied by the service with the lowest priority from the currently established physical links;
and determining the physical link occupied by the selected service with the lowest priority as the physical link of the second sub-equipment.
In one possible implementation, the method further includes:
and after the service triggered by the service triggering message is completed with the first sub-equipment, setting the priority of the service occupying the physical link of the first sub-equipment as the lowest priority in the priorities of the services occupying the currently established physical link.
In one possible implementation manner, the selecting the physical link of the second sub-device from the currently established physical links includes:
selecting a physical link with the longest connection duration from the currently established physical links;
and determining the physical link with the longest connection duration as the physical link of the second sub-device.
In one possible implementation, the method further includes:
and if the physical link with the first sub-equipment is inquired, completing the service triggered by the service triggering message with the first sub-equipment.
In one possible implementation manner, after the physical link is established with the first sub-device, the method further includes:
and completing the service triggered by the service triggering message with the first sub-equipment.
In a possible implementation manner, the service triggering message includes identification information of the first sub-device and a service type of the triggered service.
In one possible implementation manner, after the setting the physical link of the second sub-device to be a virtual link, the method further includes:
and receiving the heartbeat information sent by the second sub-equipment in the receiving period.
In one possible implementation, the physical link is a physical GATT connection.
A second aspect provides a link control apparatus comprising:
the first query module is used for responding to the received service triggering message of the first sub-equipment and querying whether a physical link is established with the first sub-equipment or not;
the second query module is used for querying whether an idle link exists currently if the first query module queries that a physical link is not established with the first sub-equipment;
the selecting module is used for selecting a physical link of the second sub-equipment from the currently established physical links according to the set link dynamic allocation rule if the second query module queries that no idle link exists currently, wherein the physical link of the second sub-equipment is a physical link conforming to the set link dynamic allocation rule;
the first setting module is used for setting the physical link of the second sub-equipment as a virtual link;
and the establishing module is used for establishing a physical link with the first sub-equipment.
In one possible implementation manner, the establishing module is further configured to establish a physical link with the first sub-device if the second querying module queries that an idle link exists currently.
In one possible implementation manner, the first setting module is configured to break a physical link of the second sub-device, and establish the virtual link with the second sub-device.
In one possible implementation manner, the selecting module is configured to select, if it is determined that at least one of priorities of services occupying the currently established physical link is lower than the priority of the service of the first sub-device, a physical link occupied by a service having the lowest priority from the currently established physical links; and determining the physical link occupied by the selected service with the lowest priority as the physical link of the second sub-equipment.
In one possible implementation manner, the selecting module is configured to wait for a set period of time if it is determined that the priorities of the services occupying the currently established physical link are not lower than the priorities of the services of the first sub-device; if judging that at least one priority of the service occupying the currently established physical link is lower than the priority of the service of the first sub-device after the set time period, selecting a physical link occupied by the service with the lowest priority from the currently established physical links; and determining the physical link occupied by the selected service with the lowest priority as the physical link of the second sub-equipment.
In one possible implementation, the apparatus further includes:
And the second setting module is used for setting the priority of the service occupying the physical link of the first sub-equipment to be the lowest priority in the priorities of the services occupying the currently established physical link after the service triggered by the service triggering message is completed.
In one possible implementation manner, the selecting module is configured to select a physical link with the longest connection duration from currently established physical links; and determining the physical link with the longest connection duration as the physical link of the second sub-device.
In one possible implementation, the apparatus further includes:
and the execution module is used for completing the service triggered by the service triggering message with the first sub-equipment if the first query module queries that the physical link is established with the first sub-equipment.
In one possible implementation, the apparatus further includes:
and the execution module is used for completing the service triggered by the service triggering message with the first sub-equipment after the physical link is established between the establishment module and the first sub-equipment.
In one possible implementation, the apparatus further includes:
and the receiving and transmitting module is used for receiving the heartbeat information sent by the second sub-equipment in the receiving period after the first setting module sets the physical link of the second sub-equipment as the virtual link.
A third aspect provides a communication system comprising: the system comprises a main device, a first sub-device and a second sub-device;
the main equipment is used for responding to the received service triggering message of the first sub-equipment and inquiring whether a physical link is established with the first sub-equipment or not; if no physical link is found to be established with the first sub-equipment, inquiring whether an idle link exists currently; if no idle link exists currently, selecting a physical link of the second sub-equipment from the currently established physical links according to the set link dynamic allocation rule, wherein the physical link of the second sub-equipment is a physical link conforming to the set link dynamic allocation rule; setting a physical link of the second sub-device as a virtual link;
the first sub-device is configured to establish a physical link with the device.
A fourth aspect provides a master device comprising: one or more processors; a memory; and one or more computer programs, wherein the one or more computer programs are stored in the memory, the one or more computer programs comprising instructions that, when executed by the master device, cause the master device to perform the link control method of the first aspect or any of the possible implementations of the first aspect.
A fifth aspect provides a computer readable storage medium comprising a stored program, wherein the program when run controls a host device in which the computer readable storage medium is located to perform the link control method of the first aspect or any possible implementation of the first aspect.
A sixth aspect provides a computer program product comprising instructions which, when run on a computer or on any of the at least one processor, cause the computer to perform the link control method of the first aspect or any of the possible implementations of the first aspect.
In the technical scheme provided by the embodiment of the invention, the main equipment selects the physical link of the second sub-equipment from the currently-established physical links according to the set link dynamic allocation rule after receiving the service trigger message of the first sub-equipment, so that the physical link of the second sub-equipment is set as a virtual link and is established with the first sub-equipment, the main equipment and the second sub-equipment cannot disconnect the physical link after completing the triggered service, repeated disconnection and establishment of the physical link are avoided, and therefore, the time for disconnecting and establishing the physical link is optimized without modifying a protocol stack, the universality of the link control scheme is improved, and the link control scheme can be widely applied to ecological products and full-house intelligent scenes.
[ description of the drawings ]
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the embodiments will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram of a communication system in some embodiments;
FIG. 2 is a schematic diagram of a communication system in alternative embodiments;
FIG. 3 is a schematic diagram of the hardware architecture of an electronic device in some embodiments;
FIG. 4 is a flow chart of a link control method in some embodiments;
FIG. 5 is a flow chart of a method of link control in other embodiments;
FIG. 6 is a schematic diagram of a link control apparatus in some embodiments;
fig. 7 is a schematic diagram of the structure of a master device in some embodiments.
[ detailed description ] of the invention
For a better understanding of the technical solution of the present invention, the following detailed description of the embodiments of the present invention refers to the accompanying drawings.
It should be understood that the described embodiments are merely some, but not all, embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The terminology used in the embodiments of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in this application and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be understood that the term "and/or" used in the embodiments of the present invention is merely an association relationship describing the association object, and indicates that three relationships may exist, for example, a and/or b may indicate: the first and second cases exist separately, and the first and second cases exist separately. In addition, the character "/" in the embodiment of the present invention generally indicates that the front and rear association objects are in an or relationship.
In the related art, due to the limitation of the hardware rule, the maximum GATT link number that can be supported by the chip of the BLE gateway device is limited, so that the BLE gateway device cannot realize connection control on more BLE sub-devices. In order to solve the above technical problems, a related art proposes a master-slave bluetooth device connection method, which includes: s1, a Bluetooth slave terminal device sends a pairing request to a Bluetooth master terminal device; s2, after the Bluetooth master terminal equipment receives the pairing request and is successfully matched with the Bluetooth slave terminal equipment, the Bluetooth master terminal equipment acquires and stores characteristic parameters of the Bluetooth slave terminal equipment; s3, the Bluetooth master terminal device sends a Bluetooth connection request to the Bluetooth slave terminal device; s4, after the Bluetooth master device confirms that the Bluetooth slave device receives the connection request and agrees with the connection request, the Bluetooth master device reads the characteristic parameters of the Bluetooth slave device stored by the Bluetooth master device; s5, the Bluetooth master terminal device modifies a Bluetooth protocol stack according to the read characteristic parameters of the Bluetooth slave terminal device and establishes Bluetooth connection with the Bluetooth slave terminal device; s6, the Bluetooth master terminal equipment and the Bluetooth slave terminal equipment exchange data based on a read command or a write command, and after the data exchange is completed, the Bluetooth master terminal equipment disconnects Bluetooth connection with the Bluetooth slave terminal equipment; and when the Bluetooth master terminal equipment needs to be connected with the Bluetooth slave terminal equipment again, repeating the steps S3 to S6. In the related art, a bluetooth master device initiates a connection request, a bluetooth protocol stack is modified and then is connected with a bluetooth slave device, data exchange is carried out between the bluetooth master device and the bluetooth slave device after connection is successful, the bluetooth master device and the bluetooth slave device are disconnected after the data exchange is completed, and the bluetooth master device and the bluetooth slave device are required to modify the bluetooth protocol stack to optimize time parameters, so that the time for completing connection, data exchange and disconnection is less than 1 second, the number of networking users is not limited, and the bluetooth master device can realize connection control over more bluetooth slave devices.
However, in the related art, in order to implement connection control on more bluetooth slave devices, the GATT link needs to be repeatedly disconnected and established, and a protocol stack needs to be modified to optimize the time for disconnecting and establishing the GATT link, so that the universality of the scheme is poor, and the scheme cannot be widely applied to ecological products and full-house intelligent scenes.
In order to solve the technical problems in the related art, the embodiment of the invention provides a communication system. Fig. 1 is a schematic diagram of a communication system in some embodiments, as shown in fig. 1, the system comprising: a master device 200 and a plurality of sub-devices 210. Pairing can be performed between the master device 200 and each of the sub-devices 210, and the master device 200 can establish communication links with multiple sub-devices 210 simultaneously to maintain a communication connection. In some embodiments, the pairing between the master device 200 and the slave device 210 may be performed by BLE and a communication link established. Illustratively, 3 sub-devices 210 are depicted in FIG. 1 as an example.
The master device 200 may be used to manage and control a plurality of sub-devices 210. In some embodiments, the master device 200 and the plurality of sub-devices 210 may be applied to an extension of a communication link of a full-house intelligent scenario, for example, the master device 200 may be a gateway device, the sub-devices 210 may include ecological products of different fields, which may include automotive and peripheral products, office equipment, sports fitness products, personal care products, smart home products, etc., which are not listed here. For example, the kiosks 210 include, but are not limited to, smart car aromatherapy, smart sockets, smart treadmills, smart toothbrushes, smart door locks, and the like.
In the embodiment of the present invention, taking the pairing between the master device 200 and the slave device 210 through BLE and the establishment of the communication link as an example, the communication link established between the master device 200 and the slave device 210 is a GATT link. Fig. 2 is a schematic structural diagram of a communication system in other embodiments, as shown in fig. 2, where, based on the communication system shown in fig. 1, a master device 200 is a BLE gateway device, and a slave device 210 is a BLE sub-device. The BLE gateway device is used for managing and controlling BLE sub-devices, and has BLE communication capability and wireless Station (Wi-Fi STA) capability; the BLE sub-device is an object managed and controlled by the BLE gateway device, the BLE sub-device has BLE communication capability, and the BLE sub-device can establish a GATT link with the BLE gateway device.
As shown in fig. 2, in some embodiments, the communication system further comprises an electronic device 100, the electronic device 100 are Wi-Fi STA capable and the electronic device 100 is installed with an Application (APP), through which the electronic device 100 can add the master device 200 and through which the sub-device 210 can be added or controlled by the master device 200. In some embodiments, electronic device 100 includes, but is not limited to, a mount Or other operating system device. Electronic devices include, but are not limited to, cell phones, tablet computers, notebook computers, desktop computers, smart screens, and the like.
As shown in fig. 2, in some embodiments, the communication system further includes a router 220, where the router 220 may be connected to the Internet (Internet) to provide a network and have a capability of a wireless Access Point (Wi-Fi AP). For example, the electronic device 100 may connect to the Wi-Fi AP provided by the router 220 to access the internet, and the master device 200 may connect to the Wi-Fi AP provided by the router 220 to access the internet.
As shown in fig. 2, in some embodiments, the communication system further includes a cloud device 230, where the cloud device 230 is a data exchange medium between the electronic device 100 and the host device 200.
As shown in fig. 3, a schematic hardware structure of the electronic device in fig. 2 is provided, and as shown in fig. 3, the electronic device 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, a key 190, a motor 191, an indicator 192, a camera 193, a display 194, and a subscriber identity module (subscriber identification module, SIM) card interface 195. It should be understood that the illustrated structure of the embodiment of the present invention does not constitute a specific limitation on the electronic device 100. In other embodiments of the invention, electronic device 100 may include more or fewer components than shown, or certain components may be combined, or certain components may be split, or different arrangements of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
The processor 110 may include one or more processing units, such as: the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), a controller, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, and/or a neural network processor (neural-network processing unit, NPU), etc. Wherein the different processing units may be separate devices or may be integrated in one or more processors. The controller can generate operation control signals according to the instruction operation codes and the time sequence signals to finish the control of instruction fetching and instruction execution. A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may hold instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to reuse the instruction or data, it can be called directly from the memory. Repeated accesses are avoided and the latency of the processor 110 is reduced, thereby improving the efficiency of the system.
In some embodiments, the processor 110 may include one or more interfaces. The interfaces may include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous receiver transmitter (universal asynchronous receiver/transmitter, UART) interface, a mobile industry processor interface (mobile industry processor interface, MIPI), a general-purpose input/output (GPIO) interface, a subscriber identity module (subscriber identity module, SIM) interface, and/or a universal serial bus (universal serial bus, USB) interface, among others. It should be understood that the interfacing relationship between the modules illustrated in the embodiments of the present invention is only illustrative, and is not meant to limit the structure of the electronic device 100. In other embodiments of the present invention, the electronic device 100 may also employ different interfacing manners in the above embodiments, or a combination of multiple interfacing manners.
The charge management module 140 is configured to receive a charge input from a charger. The charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charge management module 140 may receive a charging input of a wired charger through the USB interface 130. In some wireless charging embodiments, the charge management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100. The charging management module 140 may also supply power to the electronic device through the power management module 141 while charging the battery 142.
The power management module 141 is used for connecting the battery 142, and the charge management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and/or the charge management module 140 to power the processor 110, the internal memory 121, the display 194, the camera 193, the wireless communication module 160, and the like. The power management module 141 may also be configured to monitor battery capacity, battery cycle number, battery health (leakage, impedance) and other parameters. In other embodiments, the power management module 141 may also be provided in the processor 110. In other embodiments, the power management module 141 and the charge management module 140 may be disposed in the same device.
The wireless communication function of the electronic device 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 electronic device 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/6G, etc. applied on the electronic device 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 technology (near field communication, NFC), infrared technology (IR), etc., as applied on the electronic device 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 some embodiments, antenna 1 and mobile communication module 150 of electronic device 100 are coupled, and antenna 2 and wireless communication module 160 are coupled, such that electronic device 100 may communicate with a network and other devices through wireless communication techniques. The wireless communication techniques may include the Global System for Mobile communications (global system for mobile communications, GSM), general packet radio service (general packet radio service, GPRS), code division multiple access (code division multiple access, CDMA), wideband code division multiple access (wideband code division multiple access, WCDMA), time division code division multiple access (time-division code division multiple access, TD-SCDMA), long term evolution (long term evolution, LTE), 5G and subsequent evolution standards, BT, GNSS, WLAN, NFC, FM, and/or IR techniques, among others. The GNSS may include a global satellite positioning system (global positioning system, GPS), a global navigation satellite system (global navigation satellite system, GLONASS), a beidou satellite navigation system (Beidou navigation satellite system, BDS), a quasi zenith satellite system (quasi-zenith satellite system, QZSS) and/or a satellite based augmentation system (satellite based augmentation systems, SBAS).
The electronic device 100 implements display functions through a GPU, a display screen 194, an application processor, and the like. The GPU is a microprocessor for image processing, and is connected to the display 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute instructions to generate or change display information. Electronic device 100 may implement shooting functionality through an ISP, one or more cameras 193, video codecs, a GPU, one or more display screens 194, an application processor, and the like.
The external memory interface 120 may be used to connect an external memory card, such as a Micro SD card, to enable expansion of the memory capabilities of the electronic device 100. The external memory card communicates with the processor 110 through an external memory interface 120 to implement data storage functions. For example, files such as music, video, etc. are stored in an external memory card.
The internal memory 121 may be used to store computer executable program code including instructions. The internal memory 121 may include a storage program area and a storage data area. The storage program area may store an application program (such as a sound playing function, an image playing function, etc.) required for at least one function of the operating system, etc. The storage data area may store data created during use of the electronic device 100 (e.g., audio data, phonebook, etc.), and so on. In addition, the internal memory 121 may include a high-speed random access memory, and may further include a nonvolatile memory such as at least one magnetic disk storage device, a flash memory device, a universal flash memory (universal flash storage, UFS), and the like. The processor 110 performs various functional applications of the electronic device 100 and data processing by executing instructions stored in the internal memory 121 and/or instructions stored in a memory provided in the processor.
The electronic device 100 may implement audio functions through an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, an application processor, and the like. Such as music playing, recording, etc.
The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, and the like. The touch sensor 180K is also referred to as a "touch device". The touch sensor 180K may be disposed on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, which is also called a "touch screen". The touch sensor 180K is for detecting a touch operation acting thereon or thereabout. The touch sensor may communicate the detected touch operation to the application processor to determine the touch event type. Visual output related to touch operations may be provided through the display 194. In other embodiments, the touch sensor 180K may also be disposed on the surface of the electronic device 100 at a different location than the display 194.
The SIM card interface 195 is used to connect a SIM card. The SIM card may be inserted into the SIM card interface 195, or removed from the SIM card interface 195 to enable contact and separation with the electronic device 100. The electronic device 100 may support 1 or N SIM card interfaces, N being a positive integer greater than 1. The SIM card interface 195 may support Nano SIM cards, micro SIM cards, and the like. The same SIM card interface 195 may be used to insert multiple cards simultaneously. The types of the plurality of cards may be the same or different. The SIM card interface 195 may also be compatible with different types of SIM cards. The SIM card interface 195 may also be compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to realize functions such as communication and data communication. In some embodiments, the electronic device 100 employs esims, i.e.: an embedded SIM card. The eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100.
In order to solve the technical problems in the related art, the embodiment of the invention provides a link control method, a device, a master device and a communication system based on the communication system shown in fig. 1 or fig. 2. Fig. 4 is a flow chart of a method of link control in some embodiments, as shown in fig. 4, comprising:
step 102, the main device responds to the received service triggering message of the first sub-device, inquires whether a physical link is established with the first sub-device, and if not, step 104 is executed; if yes, go to step 112.
In the plurality of sub-devices 210 of the communication system shown in fig. 1 or fig. 2, the master device receives a service trigger message of a certain sub-device, where the service trigger message is used for triggering a service, the master device needs to complete the service triggered by the service trigger message with the certain sub-device, and at this time, a sub-device, which needs to complete the triggered service with the master device, in the plurality of sub-devices 210 is a first sub-device.
In some embodiments, the service trigger message includes identification information of the first sub-device and a service type of the triggered service. The identification information of the first sub-device is used to identify the first sub-device, for example, the identification information of the first sub-device may include a Serial Number (SN), and after receiving the service triggering message, the master device may identify, according to the identification information of the first sub-device, a service that needs to trigger the first sub-device. The service type is used to indicate which type of service needs to be triggered, for example, the service type may include adding a sub-device, controlling a sub-device, upgrading an Over-the-Air Technology (OTA) of the sub-device, broadcasting reconnection of the sub-device, and the like, and the main device may identify which type of service needs to be triggered according to the service type after receiving the service trigger message.
In one possible implementation manner, if the user needs to perform a service operation on the first sub-device, the electronic device responds to the service triggering operation input by the user to generate a service triggering message of the first sub-device, and sends the service triggering message of the first sub-device to the main device through the cloud device, so that the main device receives the service triggering message of the first sub-device.
In another possible implementation manner, if the first sub-device needs to perform a service operation, the first sub-device may broadcast a service trigger message of the first sub-device, and the master device may receive the service trigger message broadcast by the first sub-device.
After receiving the service triggering message of the first sub-device, the main device needs to complete the service triggered by the service triggering message with the first sub-device. Before completing the service triggered by the service trigger message, the master device needs to establish a physical link with the first sub-device, so in step 102, after receiving the service trigger message, the master device needs to first query whether the physical link is already established with the first sub-device. If the master device inquires that the physical link is established with the first sub-device, it indicates that the physical link between the master device and the first sub-device is not disconnected, and the first sub-device is always kept online, so that the master device and the first sub-device do not need to establish the physical link again, and the step 112 can be continuously executed. If the master device queries that the physical link is not established with the first sub-device, it indicates that the physical link between the master device and the first sub-device is disconnected, and therefore, the master device needs to establish the physical link with the first sub-device, and step 104 may be continued.
Step 104, the master device queries whether an idle link exists currently, if not, step 106 is executed; if yes, go to step 110.
An idle link is a link that is not occupied by a child device, where unoccupied by a child device refers to a current primary device not establishing a physical link with the child device. If the master device queries that an idle link exists currently, it indicates that an unoccupied link exists currently, and at this time, a physical link can be directly established with the first sub-device through the unoccupied idle link, that is: step 110 is continued. If the master device queries that there is no idle link currently, indicating that all links are occupied currently, there is no unoccupied link currently, and the master device cannot directly establish a physical link with the first sub-device, step 106 may be continuously performed.
The number of physical links that a master device establishes simultaneously with multiple sub-devices is limited, e.g., the number of maximum physical links supported by the master device is 7. If the main device and the 5 sub devices respectively establish physical links, and the number of the physical links currently established by the main device and the 5 sub devices is 5, 2 idle links currently exist, and the step 110 can be continuously executed; if the master device and the 7 sub-devices respectively establish physical links, and the number of physical links currently established by the master device and the 7 sub-devices is 7, no idle link currently exists, and step 106 may be continuously performed.
And 106, the main equipment selects a physical link of the second sub-equipment from the currently established physical links according to the set link dynamic allocation rule, wherein the physical link of the second sub-equipment is a physical link conforming to the set link dynamic allocation rule.
In the embodiment of the invention, the currently established physical link is the physical link established by the main equipment and the sub equipment, and the set link dynamic allocation rule can be used for carrying out dynamic allocation management on the currently established physical link so that the main equipment selects the physical link which can be occupied by the service of the first sub equipment from the currently established physical link. The physical link that can be occupied by the service of the first sub-device and selected in step 106 is the physical link of the second sub-device, and the physical link of the second sub-device is the physical link that meets the set link dynamic allocation rule.
In one possible implementation, the link dynamic allocation rules may be set according to traffic priority. Different services have different priorities, and for higher priority services, a sub-device executing the service can preferentially establish a physical link with the main device, so that after the physical link is established, the triggered service can be preferentially completed through the established physical link.
In some embodiments, the set link dynamic allocation rules may include: if at least one of the priorities of the services occupying the currently established physical link is lower than the priority of the service of the first sub-device, selecting one physical link occupied by the service with the lowest priority from the currently established physical link. Step 106 may specifically include:
step S11, if the master device determines that at least one of the priorities of the services occupying the currently established physical link is lower than the priority of the service of the first sub-device, selecting a physical link occupied by the service with the lowest priority from the currently established physical link.
By way of example, the traffic occupying the currently established physical link may include traffic a, traffic B, traffic C, and traffic D, wherein the priority of traffic C and the priority of traffic D are lower than the priority of traffic of the first sub-device. If the priority of the service C is lower than that of the service D, namely the priority of the service C is the lowest, the main equipment selects a physical link occupied by the service C from the physical links currently established; if the priorities of the service C and the service D are the same, randomly selecting a physical link occupied by the service C from the physical links occupied by the service C and the service D, for example, randomly selecting the physical link occupied by the service C from the physical links occupied by the service C and the service D by the master device.
For example, the traffic occupying the currently established physical link may include a plurality of traffic C, i.e. each traffic C occupies one currently established physical link, wherein the priority of traffic C is lower than the priority of traffic of the first sub-device, i.e. the priority of traffic C is the lowest. The master device randomly selects one physical link occupied by service C from the physical links occupied by the plurality of services C.
And step S12, the main equipment determines the physical link occupied by the selected service with the lowest priority as the physical link of the second sub-equipment.
Illustratively, the master device determines the physical link occupied by the selected service C as the physical link of the second sub-device.
In other embodiments, the set link dynamic allocation rules may include: if the priority of the service occupying the currently established physical link is not lower than the priority of the service of the first sub-device, waiting for a set period of time, and if at least one of the priorities of the services occupying the currently established physical link is lower than the priority of the service of the first sub-device after the set period of time, selecting the physical link occupied by the service with the lowest priority from the currently established physical links. Step 106 may specifically include:
And S21, if judging that the priority of the service occupying the currently established physical link is not lower than the priority of the service of the first sub-device, the main device waits for a set time period.
By way of example, the traffic occupying the currently established physical link may include traffic a, traffic B, traffic C, and traffic D, wherein traffic a, traffic B, traffic C, and traffic D are no less prioritized than traffic of the first sub-device. The master device may wait for a set period of time, where the different set periods of time corresponding to different services are different for different services, and thus the set period of time corresponding to the service may be set according to the service type. For example, when the service type is OTA upgrade, the set time period is 10 minutes.
Step S22, after the set time period, if the master device determines that at least one of the priorities of the services occupying the currently established physical link is lower than the priority of the service of the first sub-device, selecting a physical link occupied by the service with the lowest priority from the currently established physical links.
For example, after the master device completes execution of the service D in the set period of time, the priority of the service D is set to be the lowest priority among the priorities of the services occupying the currently established physical link, where the priority of the service D is lower than the priorities of the service a, the service B, and the service C. And after the set time period, if the main equipment judges that the priority of the service D is lower than that of the service of the first sub-equipment, selecting a physical link occupied by the service C.
And S23, determining the physical link occupied by the selected service with the lowest priority as the physical link of the second sub-equipment.
Illustratively, the master device determines the physical link occupied by the selected service C as the physical link of the second sub-device.
In other embodiments, the set link dynamic allocation rules may include: and if judging that the priority of the service occupying the currently established physical link is not lower than the priority of the service of the first sub-device, waiting for a set period of time, and after the set period of time, if judging that the priority of the service occupying the currently established physical link is not lower than the priority of the service of the first sub-device, stopping executing the step of selecting the physical link of the second sub-device from the currently established physical links. The method further comprises:
and step S31, if the main equipment judges that the priority of the service occupying the currently established physical link is not lower than the priority of the service of the first sub-equipment, waiting for a set time period.
By way of example, the traffic occupying the currently established physical link may include traffic a, traffic B, traffic C, and traffic D, wherein traffic a, traffic B, traffic C, and traffic D are no less prioritized than traffic of the first sub-device. The master device may wait for a set period of time, where the different set periods of time corresponding to different services are different for different services, and thus the set period of time corresponding to the service may be set according to the service type. For example, when the service type is OTA upgrade, the set time period is 10 minutes.
And step S32, after the set time period, if the main equipment judges that the priority of the service occupying the currently established physical link is not lower than the priority of the service of the first sub-equipment, stopping executing the step of selecting the physical link of the second sub-equipment from the currently established physical link.
For example, after waiting for the set period, the master device may still not lower the priority of the service of the first sub-device, where the master device may not select the physical link occupied by the service with the lowest priority from the currently established physical links, so as to stop executing the step of selecting the physical link of the second sub-device from the currently established physical links, and discard the step of selecting the physical link of the second sub-device.
In another possible implementation, the link dynamic allocation rule may be set according to the connection duration of the physical link. The connection duration of different physical links is different. The starting time point of the connection duration of the physical link may be a time point when the physical link is successfully established, that is, the connection duration of the physical link may be counted from the time point when the physical link is successfully established.
In some embodiments, the set link dynamic allocation rules may include: and selecting one physical link with the longest connection duration from the currently established physical links. Step 106 may specifically include:
Step S41, the main equipment selects a physical link with the longest connection duration from the currently established physical links.
For example, the currently established physical link may include a physical link occupied by a service a, a physical link occupied by a service B, a physical link occupied by a service C, and a physical link occupied by a service D, where a connection duration of the physical link occupied by the service a is longest, and the master device selects the physical link occupied by the service a from the currently established physical links.
Step S42, the main device determines the physical link with the longest connection duration as the physical link of the second sub-device.
Illustratively, the master device determines the physical link occupied by service a as the physical link of the second sub-device.
Step 108, the master device sets the physical link of the second sub-device as a virtual link.
In some embodiments, the master device disconnects the physical link of the second sub-device and establishes a virtual link with the second sub-device. After the main device takes the physical link device of the second sub-device as a virtual link, the service of the second sub-device no longer occupies the physical link, and the physical link of the second sub-device becomes an idle link.
In some embodiments, the primary device disconnecting the physical link of the second sub-device may specifically include: the method comprises the steps that a main device sends a disconnection request to a first sub-device; the first sub-device returns a disconnect response to the master device to disconnect the physical link. In some embodiments, the air interface message interacted when the main device and the second sub-device disconnect the physical link may be grabbed, so as to determine that the main device and the second sub-device disconnect the physical link through the grabbed air interface message.
In some embodiments, the establishing a virtual link between the master device and the second sub-device may specifically include: the master device updates the state information of the second sub-device to establish the virtual link. For example, the status information may include a connection status and/or an online status, etc.
Step 110, the master device establishes a physical link with the first sub-device.
Because the physical link of the second sub-device becomes an idle link, the main device inquires that the idle link exists, and establishes the physical link with the first sub-device through the idle link so that the service of the first sub-device occupies the established physical link.
In some embodiments, step 110 may specifically include: the method comprises the steps that a main device receives a broadcast packet sent by a first sub device; the main equipment sends a connection request to the first sub-equipment according to the stored characteristic information of the first sub-equipment; the first sub-device returns a connection response to the master device to establish the physical link. In some embodiments, the air interface message interacted when the master device and the first sub-device establish the physical link may be grabbed, so as to determine that the master device and the first sub-device establish the physical link through the grabbed air interface message.
If the master device establishes a physical link with the first sub-device for the first time, the master device needs to pair with the first sub-device before establishing a physical link with the first sub-device. Specifically, the main device sends a pairing request to the first sub-device according to the physical address of the first sub-device broadcasted by the first sub-device; the first sub-device and the main device are successfully paired and a pairing response is returned to the main device; the master device stores the feature information of the first sub-device, for example, the feature information may include a physical address of the first sub-device, which may be a media access control (Media Access Control, abbreviated as MAC) address, authentication information, and the like. After the pairing of the main device and the first sub-device is completed, the main device can establish a physical link with the first sub-device according to the stored characteristic information of the first sub-device.
If the main device and the first sub-device do not establish a physical link for the first time, the main device can establish a physical link with the first sub-device according to the stored characteristic information of the first sub-device without executing a pairing process, so that quick connection is realized.
Step 112, the main device and the first sub-device complete the service triggered by the service triggering message.
In some embodiments, step 112 may further include: the main equipment sends a response execution result to the cloud equipment, and the cloud equipment returns the response execution result to the electronic equipment.
In some embodiments, for the schemes shown in steps S11 to S12 and the schemes shown in steps S21 to S23, after step 112, it may further include: the priority of the service occupying the physical link of the first sub-device is set to be the lowest priority of the priorities of the services occupying the physical link currently established by the main device, so that the main device can select the physical link of the second sub-device in the process of continuously executing the steps 102 to 112 after receiving the service trigger message of other sub-devices, thereby improving the probability of selecting the physical link of the second sub-device.
In the related art, a master device determines whether a slave device is online by whether the slave device establishes a physical link with the master device. For example, if the sub-device establishes a physical link with the main device, the main device determines that the sub-device is online; if the sub-device and the main device do not establish a physical link, the main device judges that the sub-device is not on-line. After the physical link is disconnected with the sub-device, the main device returns a link disconnection notification to the electronic device, the electronic device displays that the sub-device is in an off-line state according to the link disconnection notification, and a user perceives that the physical link between the sub-device and the main device is disconnected through the off-line state displayed by the electronic device.
In the embodiment of the invention, the main device can judge whether the sub-device is on-line or not by judging whether the heartbeat information sent by the sub-device is received in the receiving period, if the main device receives the heartbeat information sent by the sub-device in the receiving period, the sub-device is judged to be on-line, and if the main device does not receive the heartbeat information sent by the sub-device in the receiving period, the sub-device is judged to be off-line. Wherein the sub-device may broadcast heartbeat information to enable the master device to receive the heartbeat information within a receive period. In some embodiments, the main device sets the physical link of the second sub-device as a virtual link, although the physical link between the main device and the second sub-device is disconnected, because the main device establishes the virtual link with the second sub-device, the second sub-device still transmits heartbeat information, the main device receives the heartbeat information transmitted by the second sub-device in a receiving period, determines that the second sub-device is online according to the heartbeat information, and does not transmit a link disconnection notification to the electronic device through the cloud device, the electronic device still displays that the second sub-device is in an online state, so that the user cannot perceive that the physical link between the main device and the second sub-device is disconnected through the online state displayed by the electronic device, and the main device and the second sub-device are disconnected under the condition that the user does not perceive the physical link, and further, the main device can support the connection of more sub-devices under the condition that the user does not perceive the physical link, and can control and manage the more sub-devices.
In the technical scheme of the link control method provided by the embodiment of the invention, the main equipment responds to the received service triggering message of the first sub-equipment, if no physical link is established with the first sub-equipment and no idle link exists currently, the physical link of the second sub-equipment is selected from the currently established physical links according to the set link dynamic allocation rule, the physical link of the second sub-equipment is set as a virtual link, and the physical link is established with the first sub-equipment.
In the technical scheme of the embodiment of the invention, under the condition that the maximum number of physical links supported by the chip of the main equipment is limited, the main equipment can support the connection of more sub-equipment by dynamically adjusting the physical link resources and establishing the virtual links, thereby realizing the expansion of the physical links supported by the main equipment and enabling the main equipment to control and manage the more sub-equipment. For example, in the embodiment of the invention, under the condition that the maximum number of the physical links supported by the chip of the main device is 7, the main device can support the connection of 20 sub-devices by dynamically adjusting the physical link resources and establishing the virtual links, so that the expansion of the physical links supported by the main device is realized, and the main device can control and manage more sub-devices.
According to the technical scheme, the physical link is not repeatedly disconnected and established, the protocol stack is not required to be modified to optimize the time for disconnecting and establishing the physical link, and the link control scheme of the embodiment of the invention can be realized through a standard protocol, so that the universality of the link control scheme is improved, and the link control scheme can be widely applied to ecological products and full-house intelligent scenes.
In the embodiment of the present invention, the master device may be a BLE gateway device, the first sub-device may be a first BLE sub-device, the second sub-device may be a second BLE sub-device, and the physical link may be a physical GATT link. The workflow of the link control method is illustrated by way of a specific embodiment. Fig. 5 is a flowchart of a link control method in other embodiments, as shown in fig. 5, including:
step 202, the electronic device sends a service triggering message of the first BLE sub-device to the cloud device.
The electronic device generates a service trigger message of the first sub-device in response to a service trigger operation input by a user, where the service trigger message may include identification information of the first sub-device and a service type, and for example, the service type may be the control sub-device.
Step 204, the cloud device sends a service triggering message of the first BLE sub-device to the BLE gateway device.
In step 206, the BLE gateway device responds to the service trigger message of the first BLE sub-device, and queries that a physical GATT link is not established with the first BLE sub-device, and queries that an idle link exists currently.
The BLE gateway device may identify, according to the identification information of the first sub-device, a service that needs to trigger the first BLE sub-device, and identify, according to the service type, which type of service needs to be triggered, for example, the BLE gateway device identifies a service that needs to trigger a control sub-device of the first BLE sub-device, and then the BLE gateway device performs step 206.
And step 208, the BLE gateway equipment selects a physical GATT link of the second BLE sub-equipment from the currently established physical GATT links according to the set link dynamic allocation rule.
Step 210, the BLE gateway device sets the physical GATT link of the second BLE sub-device as a virtual link.
Step 212, the BLE gateway device establishes a physical GATT link with the first BLE sub-device.
Step 214, the BLE gateway device and the first BLE sub-device complete the service triggered by the service triggering message.
And the BLE gateway equipment and the first BLE sub-equipment complete the service of the control sub-equipment.
And step 216, the BLE gateway device returns a response execution result to the cloud device.
Step 218, the cloud device returns a response execution result to the electronic device.
According to the technical scheme, after receiving the service triggering message of the first BLE sub-equipment, the BLE gateway equipment selects the physical GATT link of the second BLE sub-equipment from the currently established physical GATT links according to the set link dynamic allocation rule, and further sets the physical GATT link of the second BLE sub-equipment as a virtual link and establishes the physical GATT link with the first BLE sub-equipment, the BLE gateway equipment and the second BLE sub-equipment cannot disconnect the physical GATT link after completing the triggered service, repeated disconnection and establishment of the physical GATT link are avoided, so that the protocol stack does not need to be modified to optimize the time for disconnecting and establishing the physical GATT link, the universality of a link control scheme is improved, and the link control scheme can be widely applied to ecological products and full-house intelligent scenes.
Fig. 6 is a schematic structural diagram of a link control apparatus in some embodiments, as shown in fig. 6, where the apparatus is applied to a master device, and the apparatus includes: the system comprises a first query module 11, a second query module 12, a selection module 13, a first setting module 14 and a building module 15.
The first query module 11 is configured to query whether a physical link is established with the first sub-device in response to a received service trigger message of the first sub-device. The second query module 12 is configured to query whether an idle link exists currently if the first query module 11 queries that a physical link is not established with the first sub-device. The selecting module 13 is configured to select, if the second querying module 12 queries that there is no idle link currently, a physical link of the second sub-device from the currently established physical links according to the set link dynamic allocation rule, where the physical link of the second sub-device is a physical link that meets the set link dynamic allocation rule. The first setting module 14 is configured to set the physical link of the second sub-device as a virtual link. The establishing module 15 is configured to establish a physical link with the first sub-device.
In the embodiment of the present invention, the establishing module is configured to establish a physical link with the first sub-device after the first setting module 14 sets the physical link of the second sub-device as the virtual link.
In the embodiment of the present invention, the establishing module 15 is further configured to establish a physical link with the first sub-device if the second querying module 12 queries that an idle link exists currently.
In the embodiment of the present invention, the first setting module 14 is configured to break the physical link of the second sub-device, and establish the virtual link with the second sub-device.
In the embodiment of the present invention, the selecting module 13 is configured to select a physical link occupied by a service with a lowest priority from the physical links occupied by the current establishment if it is determined that at least one of the priorities of the services occupying the current establishment is lower than the priority of the service of the first sub-device; and determining the physical link occupied by the selected service with the lowest priority as the physical link of the second sub-equipment.
In the embodiment of the present invention, the selecting module 13 is configured to wait for a set period of time if it is determined that the priorities of the services occupying the currently established physical link are not lower than the priorities of the services of the first sub-device; if judging that at least one priority of the service occupying the currently established physical link is lower than the priority of the service of the first sub-device after the set time period, selecting a physical link occupied by the service with the lowest priority from the currently established physical links; and determining the physical link occupied by the selected service with the lowest priority as the physical link of the second sub-equipment.
In an embodiment of the present invention, the apparatus further includes: a second setting module 16. The second setting module 16 is configured to set, after the service triggered by the service triggering message is completed, a priority of a service occupying a physical link of the first sub-device to be a lowest priority among priorities of services occupying currently established physical links.
In the embodiment of the present invention, the selecting module 13 is configured to select a physical link with the longest connection duration from currently established physical links; and determining the physical link with the longest connection duration as the physical link of the second sub-device.
In an embodiment of the present invention, the apparatus further includes: and an execution module 17.
As an alternative, the executing module 17 is configured to complete the service triggered by the service triggering message with the first sub-device if the first querying module 11 queries that a physical link is established with the first sub-device.
As another alternative, the executing module 17 is configured to complete the service triggered by the service triggering message with the first sub-device after the establishing module 15 establishes a physical link with the first sub-device.
In the embodiment of the present invention, the second setting module 16 may be configured to set, after the execution module 17 completes the service triggered by the service triggering message with the first sub-device, the priority of the service occupying the physical link of the first sub-device to be the lowest priority among the priorities of the services occupying the currently established physical link.
In an embodiment of the present invention, the apparatus further includes: a transceiver module 18. The transceiver module 18 is configured to receive, in a receiving period, heartbeat information sent by the second sub-device after the first setting module 14 sets the physical link of the second sub-device as a virtual link.
In the embodiment of the present invention, the transceiver module 18 is configured to receive a service triggering message of the first sub-device. Specifically, the transceiver module 18 is configured to receive a service trigger message of a first sub-device sent by the electronic device through the cloud device; or, the transceiver module 18 is configured to receive a service trigger message of the first sub-device sent by the first sub-device.
In the embodiment of the present invention, the transceiver module 18 is further configured to return a response execution result to the cloud device after the execution module 17 and the first sub-device complete the service triggered by the service triggering message, so that the cloud device returns the response execution result to the electronic device.
In the link control device provided by the embodiment of the invention, the selecting module selects the physical link of the second sub-device from the currently established physical links according to the set link dynamic allocation rule after receiving the service triggering message of the first sub-device, so that the first device module sets the physical link of the second sub-device as a virtual link and the establishing module establishes the physical link with the first sub-device, the link control device and the second sub-device cannot disconnect the physical link after completing the triggered service, repeated disconnection and establishment of the physical link are avoided, the time for disconnecting and establishing the physical link is optimized without modifying a protocol stack, and the universality of the link control scheme is improved, so that the link control device can be widely applied to ecological products and full-house intelligent scenes.
It should be appreciated that the above-described link control means is embodied in the form of functional modules. The term "module" herein may be implemented in software and/or hardware, and is not specifically limited thereto. For example, a "module" may be a software program, a hardware circuit, or a combination of both that implements the functionality described above. The hardware circuitry may include application specific integrated circuits (application specific integrated circuit, ASICs), electronic circuits, processors (e.g., shared, proprietary, or group processors, etc.) and memory for executing one or more software or firmware programs, merged logic circuits, and/or other suitable components that support the described functions.
Thus, the modules of the examples described in the embodiments of the present invention can be implemented in electronic hardware, or in a combination 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 embodiments of the present invention.
The embodiment of the invention provides a computer readable storage medium, wherein instructions are stored in the computer readable storage medium, and when the program runs, the host device where the computer readable storage medium is located is controlled to execute the steps in the embodiment of the link control method.
Embodiments of the present invention provide a computer program product comprising instructions which, when run on a computer or on any of at least one processor, cause the computer to perform the steps of the above-described link control method embodiments.
The embodiment of the invention provides a master device, which comprises: one or more processors; a memory; and one or more computer programs, wherein the one or more computer programs are stored in the memory, the one or more computer programs comprising instructions that, when executed by the master device, enable the master device to perform the various steps of the above-described link control method embodiments.
Fig. 7 is a schematic structural diagram of a master device in some embodiments, and as shown in fig. 7, the master device 200 includes: a processor 21, and a memory 22. When the main device 200 is running, the processor 21 executes computer-executable instructions in the memory 22 to perform the steps of the link control method described above.
The processor 21 may be connected to a memory 22. Memory 22 may be used to store the program code and data. Accordingly, the memory 22 may be a storage unit inside the processor 21, an external storage unit independent of the processor 21, or a component including a storage unit inside the processor 21 and an external storage unit independent of the processor 21.
It should be appreciated that in embodiments of the present invention, the processor 21 may employ a central processing unit (centralprocessing unit, CPU). The processor 21 may also be other general purpose processors, digital signal processors (digitalsignal processor, DSP), application specific integrated circuits (application specific integrated circuit, ASIC), off-the-shelf programmable gate arrays (field programmable gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, 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. Or the processor 21 may employ one or more integrated circuits for executing associated programs to carry out the techniques provided by embodiments of the present invention.
Memory 22 may include read only memory and random access memory and provides instructions and data to processor 21. A portion of the processor 21 may also include non-volatile random access memory. For example, the processor 21 may also store information of the device type.
The master device 200 may also include a communication interface 23. It should be appreciated that the communication interface 23 in the master device 200 shown in fig. 7 may be used to communicate with other devices.
Optionally, the master device 200 may also include a bus. The memory 22 and the communication interface 23 may be connected to the processor 21 via a bus. The bus may be a peripheral component interconnect standard (Peripheral Component Interconnect, PCI) bus or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, or the like. The buses may be classified as address buses, data buses, control buses, etc. For ease of illustration, only one line is shown in fig. 7, but not only one bus or one type of bus.
It should be understood that the master device 200 according to the embodiment of the present invention may correspond to a corresponding main body performing the method according to the embodiment of the present invention, and the above and other operations and/or functions of each module in the master device 200 are respectively for implementing the corresponding flow of each method according to the embodiment of the present invention, which is not described herein for brevity.
In the embodiments of the present invention, "at least one" means one or more, and "a plurality" means two or more. "and/or", describes an association relation of association objects, and indicates that there may be three kinds of relations, for example, a and/or B, and may indicate that a alone exists, a and B together, and B alone exists. Wherein A, B may be singular or plural. The character "/" generally indicates that the context-dependent object is an "or" relationship. "at least one of the following" and the like means any combination of these items, including any combination of single or plural items. For example, at least one of a, b and c may represent: a, b, c, a-b, a-c, b-c, or a-b-c, wherein a, b, c may be single or plural.
Those of ordinary skill in the art will appreciate that the various elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of 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 invention.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, and are not repeated herein.
In several embodiments provided by the present invention, any of the functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a read-only memory (ROM), a random access memory (random access memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The foregoing is merely exemplary embodiments of the present invention, and any person skilled in the art may easily conceive of changes or substitutions within the technical scope of the present invention, which should be covered by the present invention. The protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (26)

1. A method of link control, the method comprising:
responding to a received service triggering message of a first sub-device, and inquiring whether a physical link is established with the first sub-device;
if no physical link is found to be established with the first sub-equipment, inquiring whether an idle link exists currently;
if no idle link exists currently, selecting a physical link of the second sub-equipment from the currently established physical links according to the set link dynamic allocation rule, wherein the physical link of the second sub-equipment is a physical link conforming to the set link dynamic allocation rule;
setting a physical link of the second sub-device as a virtual link;
and establishing a physical link with the first sub-device.
2. The method according to claim 1, wherein the method further comprises:
and if the idle link exists currently, establishing a physical link with the first sub-equipment.
3. The method of claim 1, wherein the setting the physical link of the second sub-device as a virtual link comprises:
disconnecting the physical link of the second sub-device;
and establishing the virtual link with the second sub-equipment.
4. The method of claim 1, wherein selecting the physical link of the second sub-device from the currently established physical links according to the set link dynamic allocation rule comprises:
if judging that at least one priority of the service occupying the currently established physical link is lower than the priority of the service of the first sub-equipment, selecting a physical link occupied by the service with the lowest priority from the currently established physical links;
and determining the physical link occupied by the selected service with the lowest priority as the physical link of the second sub-equipment.
5. The method of claim 1, wherein selecting the physical link of the second sub-device from the currently established physical links according to the set link dynamic allocation rule comprises:
if judging that the priority of the service occupying the currently established physical link is not lower than the priority of the service of the first sub-equipment, waiting for a set time period;
If judging that at least one priority of the service occupying the currently established physical link is lower than the priority of the service of the first sub-device after the set time period, selecting a physical link occupied by the service with the lowest priority from the currently established physical links;
and determining the physical link occupied by the selected service with the lowest priority as the physical link of the second sub-equipment.
6. The method according to claim 4 or 5, characterized in that the method further comprises:
and after the service triggered by the service triggering message is completed with the first sub-equipment, setting the priority of the service occupying the physical link of the first sub-equipment as the lowest priority in the priorities of the services occupying the currently established physical link.
7. The method of claim 1, wherein selecting the physical link of the second sub-device from the currently established physical links comprises:
selecting a physical link with the longest connection duration from the currently established physical links;
and determining the physical link with the longest connection duration as the physical link of the second sub-device.
8. The method according to claim 1, wherein the method further comprises:
And if the physical link with the first sub-equipment is inquired, completing the service triggered by the service triggering message with the first sub-equipment.
9. The method of claim 1, wherein after the establishing a physical link with the first sub-device, further comprises:
and completing the service triggered by the service triggering message with the first sub-equipment.
10. The method according to any of claims 1 to 9, wherein the service trigger message comprises identification information of the first sub-device and a service type of the triggered service.
11. The method of claim 1, wherein after setting the physical link of the second sub-device to be a virtual link, further comprising:
and receiving the heartbeat information sent by the second sub-equipment in the receiving period.
12. The method according to any of claims 1 to 11, wherein the physical link is a physical GATT connection.
13. A link control apparatus, comprising:
the first query module is used for responding to the received service triggering message of the first sub-equipment and querying whether a physical link is established with the first sub-equipment or not;
The second query module is used for querying whether an idle link exists currently if the first query module queries that a physical link is not established with the first sub-equipment;
the selecting module is used for selecting a physical link of the second sub-equipment from the currently established physical links according to the set link dynamic allocation rule if the second query module queries that no idle link exists currently, wherein the physical link of the second sub-equipment is a physical link conforming to the set link dynamic allocation rule;
the first setting module is used for setting the physical link of the second sub-equipment as a virtual link;
and the establishing module is used for establishing a physical link with the first sub-equipment.
14. The apparatus of claim 13, wherein the means for establishing is further configured to establish a physical link with the first sub-device if the second means for querying queries that an idle link currently exists.
15. The apparatus of claim 13, wherein the first setting module is configured to break a physical link of the second sub-device and establish the virtual link with the second sub-device.
16. The apparatus of claim 13, wherein the selecting module is configured to select a physical link occupied by a service with a lowest priority from among the currently established physical links if it is determined that at least one of the priorities of the services occupying the currently established physical link is lower than the priority of the service of the first sub-device; and determining the physical link occupied by the selected service with the lowest priority as the physical link of the second sub-equipment.
17. The apparatus of claim 13, wherein the selecting module is configured to wait for a set period of time if it is determined that the priorities of services occupying the currently established physical link are not lower than the priorities of services of the first sub-device; if judging that at least one priority of the service occupying the currently established physical link is lower than the priority of the service of the first sub-device after the set time period, selecting a physical link occupied by the service with the lowest priority from the currently established physical links; and determining the physical link occupied by the selected service with the lowest priority as the physical link of the second sub-equipment.
18. The apparatus according to claim 16 or 17, characterized in that the apparatus further comprises:
and the second setting module is used for setting the priority of the service occupying the physical link of the first sub-equipment to be the lowest priority in the priorities of the services occupying the currently established physical link after the service triggered by the service triggering message is completed.
19. The apparatus of claim 13, wherein the selecting module is configured to select a physical link with a longest connection duration from currently established physical links; and determining the physical link with the longest connection duration as the physical link of the second sub-device.
20. The apparatus of claim 13, wherein the apparatus further comprises:
and the execution module is used for completing the service triggered by the service triggering message with the first sub-equipment if the first query module queries that the physical link is established with the first sub-equipment.
21. The apparatus of claim 13, wherein the apparatus further comprises:
and the execution module is used for completing the service triggered by the service triggering message with the first sub-equipment after the physical link is established between the establishment module and the first sub-equipment.
22. The apparatus of claim 13, wherein the apparatus further comprises:
and the receiving and transmitting module is used for receiving the heartbeat information sent by the second sub-equipment in the receiving period after the first setting module sets the physical link of the second sub-equipment as the virtual link.
23. A communication system, comprising: the system comprises a main device, a first sub-device and a second sub-device;
the main equipment is used for responding to the received service triggering message of the first sub-equipment and inquiring whether a physical link is established with the first sub-equipment or not; if no physical link is found to be established with the first sub-equipment, inquiring whether an idle link exists currently; if no idle link exists currently, selecting a physical link of the second sub-equipment from the currently established physical links according to the set link dynamic allocation rule, wherein the physical link of the second sub-equipment is a physical link conforming to the set link dynamic allocation rule; setting a physical link of the second sub-device as a virtual link;
The first sub-device is configured to establish a physical link with the device.
24. A master device, comprising: one or more processors; a memory; and one or more computer programs, wherein the one or more computer programs are stored in the memory, the one or more computer programs comprising instructions, which when executed by the master device, cause the master device to perform the link control method of any of claims 1-12.
25. A computer-readable storage medium, characterized in that the computer-readable storage medium includes a stored program, wherein the program, when run, controls a host device in which the computer-readable storage medium is located to execute the link control method according to any one of claims 1 to 12.
26. A computer program product comprising instructions which, when run on a computer or any of the at least one processor, cause the computer to perform the link control method of any of claims 1 to 12.
CN202211042386.3A 2022-08-29 2022-08-29 Link control method, device, main equipment and communication system Pending CN117676521A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211042386.3A CN117676521A (en) 2022-08-29 2022-08-29 Link control method, device, main equipment and communication system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211042386.3A CN117676521A (en) 2022-08-29 2022-08-29 Link control method, device, main equipment and communication system

Publications (1)

Publication Number Publication Date
CN117676521A true CN117676521A (en) 2024-03-08

Family

ID=90071911

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211042386.3A Pending CN117676521A (en) 2022-08-29 2022-08-29 Link control method, device, main equipment and communication system

Country Status (1)

Country Link
CN (1) CN117676521A (en)

Similar Documents

Publication Publication Date Title
CN110320811B (en) Access method of intelligent household equipment and electronic equipment
CN115209195B (en) Terminal equipment, method and system for realizing one touch screen through remote controller
WO2021147686A1 (en) Method for guiding intelligent device to access network, and medium, control terminal, and system
WO2021036835A1 (en) Bluetooth search method and system, and related apparatus
WO2021082829A1 (en) Bluetooth connection method and related apparatus
CN111405681B (en) Wi-Fi Aware link establishment method, wi-Fi Aware link establishment system, electronic equipment and storage medium
CN110572803A (en) Bluetooth switching method and Bluetooth device
CN110582109A (en) Wireless Local Area Network (WLAN) network access method and device
CN111010693B (en) Method for providing wireless fidelity network access service and electronic equipment
CN112954819B (en) Equipment networking method, electronic equipment and system
CN111698668A (en) Wireless communication link establishing method and electronic device supporting same
CN114499587B (en) Audio synchronization communication method, system, wireless earphone, terminal and storage medium
CN116114239B (en) Volume management method and electronic equipment
CN114640972A (en) Terminal device, multilink communication method and chip
CN114125789B (en) Communication method, terminal device and storage medium
WO2021027623A1 (en) Device capability discovery method and p2p device
CN113038627B (en) File sharing method, mobile device and computer storage medium
WO2022089515A1 (en) Dual wifi connection method and electronic device
CN117676521A (en) Link control method, device, main equipment and communication system
CN112866965B (en) Intelligent glasses
CN114916054A (en) Communication method, device and terminal equipment
CN112866964B (en) Wireless earphone assembly
CN116056050A (en) Audio playing method, electronic equipment and system
CN112469014A (en) Method and electronic equipment for configuring Bluetooth connection parameters
CN113691979B (en) Wireless data transmission method, electronic device, system and storage medium

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