CN111757275A - Device connection method and device, storage medium and electronic device - Google Patents

Device connection method and device, storage medium and electronic device Download PDF

Info

Publication number
CN111757275A
CN111757275A CN202010507215.8A CN202010507215A CN111757275A CN 111757275 A CN111757275 A CN 111757275A CN 202010507215 A CN202010507215 A CN 202010507215A CN 111757275 A CN111757275 A CN 111757275A
Authority
CN
China
Prior art keywords
connectable
determining
packet
broadcast
rssi value
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.)
Granted
Application number
CN202010507215.8A
Other languages
Chinese (zh)
Other versions
CN111757275B (en
Inventor
王兵
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Haier Uplus Intelligent Technology Beijing Co Ltd
Original Assignee
Haier Uplus Intelligent Technology Beijing 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 Haier Uplus Intelligent Technology Beijing Co Ltd filed Critical Haier Uplus Intelligent Technology Beijing Co Ltd
Priority to CN202010507215.8A priority Critical patent/CN111757275B/en
Publication of CN111757275A publication Critical patent/CN111757275A/en
Application granted granted Critical
Publication of CN111757275B publication Critical patent/CN111757275B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/06Selective distribution of broadcast services, e.g. multimedia broadcast multicast service [MBMS]; Services to user groups; One-way selective calling services
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04BTRANSMISSION
    • H04B17/00Monitoring; Testing
    • H04B17/30Monitoring; Testing of propagation channels
    • H04B17/309Measuring or estimating channel quality parameters
    • H04B17/318Received signal strength
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04BTRANSMISSION
    • H04B17/00Monitoring; Testing
    • H04B17/30Monitoring; Testing of propagation channels
    • H04B17/382Monitoring; Testing of propagation channels for resource allocation, admission control or handover
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W8/00Network data management
    • H04W8/005Discovery of network devices, e.g. terminals
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Abstract

The invention provides a device connection method and device, a storage medium and electronic equipment, wherein the method comprises the following steps: receiving a first broadcast data packet; determining connectable devices according to the RSSI value in the first broadcast packet; receiving a second broadcast packet in a case where a connection is established with the connectable device; determining a non-connectable device among the connectable devices according to the RSSI value in the second broadcast packet, and determining a device that can remain connected among the connectable devices through the non-connectable device. The method solves the problem that the power of the connection between the first equipment and the discoverable second equipment is not high, further achieves the effect of updating the discoverable second equipment which can be stably connected as soon as possible by judging the strength change of the RSSI value in the broadcast data packet in the equipment while improving the success rate of the equipment connection when the second equipment is discovered.

Description

Device connection method and device, storage medium and electronic device
Technical Field
The present invention relates to the field of data communication, and in particular, to a device connection method and apparatus, a storage medium, and an electronic device.
Background
The first device and the second device adopt corresponding short-range data transmission protocols when carrying out short-range data connection. But due to the distance limit supported by the data transmission protocol, the broadcast of the device can be received when the distance is a little bit away, but the connection may fail. Furthermore, when a first device to be connected scans a surrounding second device, it is not known whether the second device has stopped broadcasting.
In the related art, no effective solution exists at present for the problem that the power of the connection between the first device and the discoverable second device is not high.
Disclosure of Invention
The embodiment of the invention provides a device connection method and a device, which are used for at least solving the problem that the power of the connection between first equipment and second equipment which can be found in the related art is not high.
According to an embodiment of the present invention, there is provided a device connection method including: receiving a first broadcast data packet; determining connectable devices according to the RSSI value in the first broadcast packet; receiving a second broadcast packet in a case where a connection is established with the connectable device; determining a non-connectable device among the connectable devices according to the RSSI value in the second broadcast packet; determining, among the connectable devices, a device that can remain connected, by the non-connectable device.
Optionally, the method further comprises, after determining, by the non-connectable device, a device that can remain connected among the connectable devices: disconnecting the non-connectable device.
Optionally, the determining connectable devices according to the RSSI value in the first broadcast packet comprises: determining the connectable device in case the RSSI values in three consecutive packets of data in the first broadcast packet are all greater than a first threshold value.
Optionally, the determining connectable devices according to RSSI values in the first broadcast packet previously comprises: discarding the three consecutive packets of data in the first broadcast packet if the RSSI value of any one of the three consecutive packets of data in the first broadcast packet is less than a first threshold value; discarding a first one of two consecutive packets of data in the first broadcast packet if the RSSI values of the two consecutive packets of data are both less than a first threshold value.
Optionally, the determining of the non-connectable devices among the connectable devices according to the RSSI value in the second broadcast packet comprises: determining a non-connectable device among the connectable devices in case the RSSI values in a plurality of consecutive data packets in the second broadcast data packet are all smaller than a second threshold value.
Optionally, the determining of the non-connectable devices among the connectable devices according to the RSSI value in the second broadcast packet comprises: determining the number of devices in the connectable devices in case the RSSI values in a consecutive plurality of the second broadcast packets are each less than a second threshold; in the case where the number of devices among the connectable devices is greater than two, a non-connectable device is determined among the connectable devices.
Optionally, the determining a non-connectable device among the connectable devices according to the RSSI value in the second broadcast packet comprises: disconnecting the non-connectable device in case that a broadcast packet is not received within a preset time period; and disconnecting the non-connectable device when the RSSI value of the N-th packet in the plurality of consecutive packets in the second broadcast packet is less than the RSSI value of the N-1-th packet, the RSSI value of the N-1-th packet is less than the RSSI value of the N-2-th packet, and the RSSI value of the N-3-th packet is less than a second threshold value.
According to another embodiment of the present invention, there is provided a device connecting apparatus including: a first receiving module, configured to receive a first broadcast packet; a first determination module for determining connectable devices according to the RSSI value in the first broadcast packet; a second receiving module for receiving a second broadcast packet in a case where a connection is established with the connectable device; a second determination module for determining a non-connectable device among the connectable devices according to the RSSI value in the second broadcast packet; a third determination module for determining a device that can remain connected among the connectable devices through the non-connectable devices.
According to a further embodiment of the present invention, there is also provided a storage medium having a computer program stored therein, wherein the computer program is arranged to perform the steps of any of the above method embodiments when executed.
According to yet another embodiment of the present invention, there is also provided an electronic device, including a memory and a processor, the memory having a computer program stored therein, the processor being configured to perform the steps of any of the above method embodiments by the computer program.
By the present invention, since connectable devices are determined according to the RSSI value in the first broadcast packet, and non-connectable devices among the connectable devices are determined according to the RSSI value in the received second broadcast packet in the case where the connectable devices establish a connection. Therefore, the problem that the power of the connection between the first device and the discoverable second device is not high can be solved, and the effect of updating the discoverable second device which can be stably connected as soon as possible by judging the strength change of the RSSI value in the broadcast data packet in the device while improving the success rate of the device connection when the second device is discovered is achieved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
fig. 1 is a block diagram of a hardware configuration of a mobile terminal according to an apparatus connection method according to an embodiment of the present invention;
FIG. 2 is a flow diagram of a method for device connection according to an alternative embodiment of the present invention;
FIG. 3 is a flow chart of a method of device connection according to an alternative embodiment of the invention;
FIG. 4 is a schematic structural diagram of an apparatus attachment arrangement in accordance with an alternative embodiment of the present invention;
fig. 5 is a flow chart of a device connection method according to an alternative embodiment of the invention.
Detailed Description
The invention will be described in detail hereinafter with reference to the accompanying drawings in conjunction with embodiments. It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order.
Example 1
The method provided by the first embodiment of the present application may be executed in a mobile terminal, a computer terminal, or a similar computing device. Taking the example of the present invention running on a mobile terminal, fig. 1 is a block diagram of a hardware structure of the mobile terminal of a data connection processing method according to an embodiment of the present invention. As shown in fig. 1, the mobile terminal may include one or more (only one shown) processors 102 (the processors 102 may include, but are not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA, etc.), a memory 104 for storing data, and a transmission device 106 for communication functions. It will be understood by those skilled in the art that the structure shown in fig. 1 is only an illustration and is not intended to limit the structure of the electronic device. For example, the mobile terminal may also include more or fewer components than shown in FIG. 1, or have a different configuration than shown in FIG. 1.
The memory 104 may be used to store computer programs, for example, software programs and modules of application software, such as computer programs corresponding to the data connection processing method in the embodiment of the present invention, and the processor 102 executes various functional applications and data processing by running the computer programs stored in the memory 104, so as to implement the above-mentioned method. The memory 104 may include high speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory located remotely from the processor 102, which may be connected to the mobile terminal over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 106 is used for receiving or transmitting data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a Network adapter (NIC), which can be connected to other Network devices through a base station so as to communicate with the internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module, which is used for communicating with the internet in a wireless manner.
For a mobile terminal as shown in fig. 1, the method comprises: BLE slave device and BLE master device. The broadcast data of the BLE slave device (BLE intelligent household electrical appliance device) carries user-defined data and an RSSI value (signal strength). The BLE master device (such as a mobile phone terminal) searches for the connectable BLE slave device, when receiving the broadcast packet of the device, a connection request can be sent out, and after the connection is established, the connection can be controlled through the BLE.
BLE device discovery logic is as follows:
step one, BLE slave equipment actively broadcasts ADV _ IND;
step two, the BLE master equipment starts to receive a BLE broadcast packet;
step three, the BLE master equipment judges whether the received ADV _ IND data conforms to the protocol agreement of the BLE master equipment, if so, the BLE master equipment represents the equipment which needs to be connected; if not, it is discarded.
And step four, if the equipment is judged to be the equipment, sending the SCAN _ REQ, and the operation can save the sending of BLE data stream of the mobile phone end and save more electricity.
And step five, after receiving the request, the BLE device sends the SCAN _ RSP, which includes more user-defined data.
In this embodiment, a method for processing a data connection operating in the mobile terminal is provided, and fig. 2 is a flowchart of a method for processing a data connection according to an embodiment of the present invention, as shown in fig. 2, the flowchart includes the following steps:
step S202, a first broadcast packet is received.
The foregoing steps are performed in a first device, where the first device receives a first data packet, where the first data packet refers to a broadcast data packet carrying an RSSI value and sent by a second device, the first device is a BLE master device used for discovering a connectable device, and the second device is a BLE slave device used for connecting with the BLE master device;
it should be noted that there is an RSSI value in each broadcast packet received at the first device. The value range of the RSSI value is 0 to-127, and if the RSSI value is < -80, the signal is considered to represent a weak signal.
It should be noted that, before receiving the first data packet, the first device may determine whether the received data conforms to its protocol convention. If the device is matched, the device is the own device needing connection. In the broadcast data of the second device (such as a BLE intelligent household appliance device), the user-defined data and the RSSI (i.e. representing the signal strength) are carried, the first device (such as a mobile phone) searches for the connectable second device, and can send out a connection request when receiving a broadcast packet of the device, and can control through the BLE after the connection is established.
Step S204, determining connectable equipment according to the RSSI value in the first broadcast data packet;
in the case where the RSSI value in the first broadcast packet satisfies a threshold, the signal strength is considered to satisfy the condition of the connectable device. And the connectable devices may be displayed in a device list according to different RSSI values. It is noted that the connectable or deletable BLE slave devices may be visually displayed in the device list at the user interface. Including one or more BLE slave devices in the second device to which connectivity may be made.
A step S206 of receiving a second broadcast packet in a case where a connection is established with the connectable device;
that is, on the premise that the connection between the first device and the second device is already connected, the first device continues to receive the second packet, where the second packet includes a plurality of consecutive broadcast packets.
And step S208, determining non-connectable devices among the connectable devices according to the RSSI value in the second broadcast packet.
Non-connectable devices are determined among the connectable devices according to the strength of the RSSI values, and the non-connectable devices may be displayed in a device list according to different RSSI values. It is noted that the second disconnectable device may be visually displayed in the device list at the user interface, so that the user may directly view through the user interface. Including one or more BLE slave devices in the second device that may be disconnected.
Step S210, through the non-connectable devices, determining a device that can remain connected among the connectable devices.
Through the above steps, since connectable devices are determined according to the RSSI value in the first broadcast packet, and non-connectable devices among the connectable devices are determined according to the RSSI value in the received second broadcast packet in case the connectable devices establish a connection. Therefore, the problem that the power of the connection between the first device and the discoverable second device is not high can be solved, and the effect of updating the discoverable second device which can be stably connected as soon as possible by judging the strength change of the RSSI value in the broadcast data packet in the device while improving the success rate of the device connection when the second device is discovered is achieved.
Preferably, the method further comprises: a device that can maintain connection is determined among the connectable devices through the non-connectable devices, as shown in fig. 3, and the connection with the non-connectable device is disconnected at step S212. I.e. if a non-connectable device is determined, the connection to said non-connectable device is disconnected.
Due to the instability of the BLE broadcasting protocol, the availability of the equipment cannot be guaranteed after one broadcast is received, the success rate of equipment connection in equipment discovery can be improved by judging the RSSI value in the broadcast data packet, meanwhile, due to the characteristics of the BLE broadcasting protocol, the first equipment cannot know that the BLE equipment stops broadcasting, and the fact that the BLE equipment stops broadcasting can be judged as accurately as possible by judging the RSSI value in the broadcast data packet again.
In an embodiment of the present application, the determining connectable devices according to the RSSI value in the first broadcast packet includes: determining the connectable device in case the RSSI values in three consecutive packets of data in the first broadcast packet are all greater than a first threshold value. That is, if the RSSI values of three consecutive packets are all greater than-80, it indicates that it is a stably connectable device.
In an embodiment of the present application, said determining connectable devices according to RSSI values in said first broadcast packet previously comprises: discarding the three consecutive packets of data in the first broadcast packet if the RSSI value of any one of the three consecutive packets of data in the first broadcast packet is less than a first threshold value; discarding a first one of two consecutive packets of data in the first broadcast packet if the RSSI values of the two consecutive packets of data are both less than a first threshold value.
If any one of three consecutive packets in the first broadcast packet has RSSI < -80 before the connectable device is determined, the RSSI value comparison process is not performed for discarding. Meanwhile, if two consecutive packets RSSI < -80 in the first broadcast packet, the first packet data is also discarded and recalculated from the next packet.
In an embodiment of the present application, the determining, among the connectable devices, a non-connectable device according to the RSSI value in the second broadcast packet includes: determining a non-connectable device among the connectable devices in case the RSSI values in a plurality of consecutive data packets in the second broadcast data packet are all smaller than a second threshold value. Specifically, for the second broadcast packet, if the RSSI values in five consecutive broadcast packets are all less than-100, it is determined that a non-connectable device, i.e., a device, among the connectable devices can be deleted.
In an embodiment of the present application, the determining, among the connectable devices, a non-connectable device according to the RSSI value in the second broadcast packet includes: determining the number of devices in the connectable devices in case the RSSI values in a consecutive plurality of the second broadcast packets are each less than a second threshold; in the case where the number of devices among the connectable devices is greater than two, a non-connectable device is determined among the connectable devices. Specifically, in the case where the RSSI values of the second broadcast packet in three consecutive broadcast packets are all less than-100, it is necessary to determine the number of currently connectable devices, and in the case where the number of connectable devices is greater than two, it is determined that a non-connectable device, that is, a device indicating that the device can be deleted, is possible. For example, the device list searched in the first 5s and the device list searched in the last 5s may be compared, if there are more than 2 different devices, it indicates that the current bluetooth environment has changed, and the mobile phone may have moved the location, and at this time, it is considered that the distance between the mobile phone and the BLE device that can be stably connected is exceeded, it indicates that the devices may be deleted.
In an embodiment of the present application, the determining a non-connectable device among the connectable devices according to the RSSI value in the second broadcast packet includes: disconnecting the non-connectable device in case that a broadcast packet is not received within a preset time period; and disconnecting the non-connectable device when the RSSI value of the Nth packet in the plurality of consecutive packets in the second broadcast packet is less than the RSSI value of the N-1 th packet, the RSSI value of the N-1 th packet is less than the RSSI value of the N-2 th packet, and the RSSI value of the N-3 th packet is less than a second threshold value. Specifically, if a plurality of packets in the second broadcast packet are smaller and the minimum RSSI value is smaller than the second threshold value, it is determined that a non-connectable device among the connectable devices, i.e., a device may be deleted. For example, if the RSSI value in four consecutive broadcast packets is smaller and the RSSI value in the last broadcast packet is less than-100, it indicates that two devices are farther and farther away and beyond the distance that can be stably connected, and indicates that the devices can be disconnected after being deleted.
Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
Example 2
In this embodiment, a data connection processing apparatus is further provided, and the apparatus is used to implement the foregoing embodiments and preferred embodiments, and details of which have been already described are omitted. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated.
FIG. 4 is a block diagram showing the construction of an apparatus for connecting devices according to an embodiment of the present invention, which includes, as shown in FIG. 4
A first receiving module 30, configured to receive a first broadcast packet;
a first determination module 32 for determining connectable devices according to the RSSI value in the first broadcast packet;
a second receiving module 34 for receiving a second broadcast packet in a case where a connection is established with the connectable device;
a second determination module 36 for determining a non-connectable device among the connectable devices according to the RSSI value in the second broadcast packet;
a third determination module 38 for determining among the connectable devices, a device that can remain connected, by means of the non-connectable devices.
In the first receiving module 30 of the embodiment of the present application, the above module is implemented in a first device, and the first device receives a first data packet, where the first data packet refers to a broadcast data packet that carries an RSSI value and is sent by a second device, the first device is a BLE master device used for discovering a connectable device, and the second device is a BLE slave device used for connecting with the BLE master device;
it should be noted that there is an RSSI value in each broadcast packet received at the first device. The value range of the RSSI value is 0 to-127, and if the RSSI value is < -80, the signal is considered to represent a weak signal.
It should be noted that, before receiving the first data packet, the first device may determine whether the received data conforms to its protocol convention. If the device is matched, the device is the own device needing connection. In the broadcast data of the second device (such as a BLE intelligent household appliance device), the user-defined data and the RSSI (i.e. representing the signal strength) are carried, the first device (such as a mobile phone) searches for the connectable second device, and can send out a connection request when receiving a broadcast packet of the device, and can control through the BLE after the connection is established.
In the first determination module 32 of the embodiment of the present application, in the case where the RSSI value in the first broadcast packet satisfies the threshold, the signal strength is considered to satisfy the condition of the connectable device. And the connectable devices may be displayed in a device list according to different RSSI values. It is noted that the connectable or deletable BLE slave devices may be visually displayed in the device list at the user interface. Including one or more BLE slave devices in the second device to which connectivity may be made.
In the second receiving module 34 of the embodiment of the present application, on the premise that the connection between the first device and the second device is already connected, the first device continues to receive the second data packet, where the second data packet includes a plurality of consecutive broadcast data packets.
In the second module 36 of the embodiment of the present application, a non-connectable device is determined among connectable devices according to the strength of the RSSI value, and the non-connectable device may be displayed in a device list according to a different RSSI value. It is noted that the second disconnectable device may be visually displayed in the device list at the user interface, so that the user may directly view through the user interface. Including one or more BLE slave devices in the second device that may be disconnected.
Through the module, since the connectable device is determined according to the RSSI value in the first broadcast packet, and the non-connectable device in the connectable device is determined according to the RSSI value in the received second broadcast packet when the connectable device establishes the connection, the problem that the power of the connection between the first device and the discoverable second device is not high can be solved, and the effect of updating the discoverable second device stably by judging the strength change of the RSSI value in the broadcast packet in the device while improving the success rate of the device connection when the second device discovers is achieved.
The first determining module 32 is further configured to determine the connectable device if the RSSI values in three consecutive packets of data in the first broadcast packet are all greater than a first threshold value.
The device further comprises: a first processing module, configured to discard three consecutive packets of data in the first broadcast packet if an RSSI value of any one of the three consecutive packets of data is smaller than a first threshold;
discarding a first one of two consecutive packets of data in the first broadcast packet if the RSSI values of the two consecutive packets of data are both less than a first threshold value.
The second determining module 36 is further configured to determine a non-connectable device among the connectable devices if the RSSI values in a plurality of consecutive packets in the second broadcast packet are all less than a second threshold.
The second determining module 36 is further configured to determine the number of devices in the connectable devices if the RSSI values in a plurality of consecutive packets in the second broadcast packet are all less than a second threshold;
in the case where the number of devices among the connectable devices is greater than two, a non-connectable device is determined among the connectable devices.
The device still includes: a second processing module for disconnecting the non-connectable device when a broadcast packet is not received within a preset time period;
and when the RSSI value of the N data packet in the continuous data packets in the second broadcast data packet is smaller than the RSSI value of the N-1 data packet, the RSSI value of the N-1 data packet is smaller than the RSSI value of the N-2 data packet, and the RSSI value of the N-3 data packet is smaller than a second threshold value, disconnecting the non-connectable device, wherein N is an integer.
It should be noted that, the above modules may be implemented by software or hardware, and for the latter, the following may be implemented, but not limited to: the modules are all positioned in the same processor; alternatively, the modules are respectively located in different processors in any combination.
In order to better understand the processing flow of the data connection, the following explains the technical solutions with reference to the preferred embodiments, but the technical solutions of the embodiments of the present invention are not limited.
The preferred embodiment of the present invention can improve the success rate of device connection in the device list when the device is found by judging the signal strength in a plurality of continuous broadcast data packets. And at the same time it can be determined as much as possible whether the device has stopped broadcasting. Therefore, the user is updated and prompted, and better user experience is achieved.
Fig. 5 is a flowchart illustrating a processing method of data connection according to a preferred embodiment of the present invention, as shown in fig. 5, including the following steps:
in step S502, a BLE device is discovered.
The discovery of BLE devices (that is, BLE devices in this application all refer to BLE slave devices, and a mobile phone terminal represents a BLE master device) mainly includes the following interaction processes: the BLE equipment actively broadcasts ADV _ IND, the mobile phone end starts to receive BLE broadcast packets, the mobile phone judges whether the received ADV _ IND data conforms to the protocol convention of the mobile phone or not, and if yes, the mobile phone indicates the equipment needing to be connected; if not, it is discarded. And if the device is judged to be the own device, the SCAN _ REQ is sent, so that the sending of BLE data streams at the mobile phone end can be saved, and more electricity can be saved. Upon receiving the request, the BLE device sends SCAN _ RSP, which includes more user-defined data.
Each packet of data received by the mobile phone end has an RSSI value, the RSSI value range is 0 to-127, if the RSSI < -80, a weak signal is represented, so the operation steps of step S506, step S508 and step S510 need to be performed.
In step S504, if the RSSI of three consecutive packets is greater than-80, it indicates that it is a device that can be stably connected.
In step S506, if any packet RSSI < -80 of the three continuous packets, the packet RSSI < -80 is discarded.
In step S508, if two consecutive packets of RSSI < -80, the first packet of data is also discarded and recalculated.
Since the BLE device may stop broadcasting data in the broadcasting process due to connection by other devices, broadcast stop of the BLE device itself, or power failure, and the BLE device is not known as a mobile phone terminal at this time, it is necessary to find that the device stops broadcasting in time, and it is necessary to continue to step S512.
Step S510, if any broadcast packet of the device is not received within 15S, it indicates that the device can delete the broadcast packet.
In step S512, if the RSSI in five consecutive broadcast packets is less than-100, it indicates that the device can be deleted.
After the RSSI in the three continuous broadcast packets is less than-100, the equipment list searched in the first 5s and the equipment list searched in the last 5s are judged to be compared; if there are more than 2 different devices, it indicates that the current bluetooth environment has changed, and the mobile phone end may have moved the position, and at this time, it is considered that the distance between the mobile phone end and the BLE device which can be stably connected has exceeded, and the device is deleted.
Step S514, if the RSSI value in the four consecutive broadcast packets is smaller and smaller, and the RSSI value in the last broadcast packet is smaller than-100, it indicates that the two devices are farther and farther away and exceed the distance that can be stably connected, and the devices are deleted.
Embodiments of the present invention also provide a storage medium having a computer program stored therein, wherein the computer program is arranged to perform the steps of any of the above method embodiments when executed.
Alternatively, in the present embodiment, the storage medium may be configured to store a computer program for executing the steps of:
s1, receiving the first broadcast packet;
s2, determining connectable equipment according to the RSSI value in the first broadcast data packet;
s3, receiving a second broadcast packet when the connectable device is connected;
s4, determining a non-connectable device among the connectable devices according to the RSSI value in the second broadcast packet;
s5, determining connectable devices among the connectable devices through the non-connectable devices.
Optionally, the storage medium is further arranged to store a computer program for performing the steps of:
s1, disconnecting the connectable device from the non-connectable device after determining the connectable device among the connectable devices.
Optionally, in this embodiment, the storage medium may include, but is not limited to: various media capable of storing computer programs, such as a usb disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk.
Embodiments of the present invention also provide an electronic device comprising a memory having a computer program stored therein and a processor arranged to perform the steps of any of the above method embodiments by means of the computer program.
Optionally, in this embodiment, the processor may be configured to execute the following steps by a computer program:
s1, receiving the first broadcast packet;
s2, determining connectable equipment according to the RSSI value in the first broadcast data packet;
s3, receiving a second broadcast packet when the connectable device is connected;
s4, determining a non-connectable device among the connectable devices according to the RSSI value in the second broadcast packet;
s5, determining connectable devices among the connectable devices through the non-connectable devices.
Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation manners, and this embodiment is not described herein again.
It will be apparent to those skilled in the art that the modules or steps of the present invention described above may be implemented by a general purpose computing device, they may be centralized on a single computing device or distributed across a network of multiple computing devices, and alternatively, they may be implemented by program code executable by a computing device, such that they may be stored in a storage device and executed by a computing device, and in some cases, the steps shown or described may be performed in an order different than that described herein, or they may be separately fabricated into individual integrated circuit modules, or multiple ones of them may be fabricated into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A device connection method, comprising:
receiving a first broadcast data packet;
determining connectable devices according to the RSSI value in the first broadcast packet;
receiving a second broadcast packet in a case where a connection is established with the connectable device;
determining a non-connectable device among the connectable devices according to the RSSI value in the second broadcast packet;
determining, among the connectable devices, a device that can remain connected, by the non-connectable device.
2. The method of claim 1, further comprising:
disconnecting, by the non-connectable device, the connection with the non-connectable device after determining a device that can remain connected among the connectable devices.
3. The method of claim 2, wherein determining connectable devices according to the RSSI value in the first broadcast packet comprises:
determining the connectable device in case the RSSI values in three consecutive packets of data in the first broadcast packet are all greater than a first threshold value.
4. The method of claim 3, wherein said determining connectable devices based on RSSI values in said first broadcast packet previously comprises:
discarding the three consecutive packets of data in the first broadcast packet if the RSSI value of any one of the three consecutive packets of data in the first broadcast packet is less than a first threshold value;
discarding a first one of two consecutive packets of data in the first broadcast packet if the RSSI values of the two consecutive packets of data are both less than a first threshold value.
5. The method according to claim 2, wherein the determining of the non-connectable devices among the connectable devices according to the RSSI value in the second broadcast packet comprises:
determining a non-connectable device among the connectable devices in case the RSSI values in a plurality of consecutive data packets in the second broadcast data packet are all smaller than a second threshold value.
6. The method according to claim 5, wherein the determining of the non-connectable devices among the connectable devices according to the RSSI value in the second broadcast packet comprises:
determining the number of devices in the connectable devices in case the RSSI values in a consecutive plurality of the second broadcast packets are each less than a second threshold;
in the case where the number of devices among the connectable devices is greater than two, a non-connectable device is determined among the connectable devices.
7. The method according to claim 5, wherein the determining a non-connectable device among the connectable devices according to the RSSI value in the second broadcast packet comprises:
disconnecting the non-connectable device in case that a broadcast packet is not received within a preset time period;
and when the RSSI value of the N data packet in the continuous data packets in the second broadcast data packet is smaller than the RSSI value of the N-1 data packet, the RSSI value of the N-1 data packet is smaller than the RSSI value of the N-2 data packet, and the RSSI value of the N-3 data packet is smaller than a second threshold value, disconnecting the non-connectable device, wherein N is an integer.
8. An apparatus connecting device, comprising:
a first receiving module, configured to receive a first broadcast packet;
a first determination module for determining connectable devices according to the RSSI value in the first broadcast packet;
a second receiving module for receiving a second broadcast packet in a case where a connection is established with the connectable device;
a second determination module for determining a non-connectable device among the connectable devices according to the RSSI value in the second broadcast packet;
a third determination module for determining a device that can remain connected among the connectable devices through the non-connectable devices.
9. A storage medium, in which a computer program is stored, wherein the computer program is arranged to perform the method of any of claims 1 to 7 when executed.
10. An electronic device comprising a memory and a processor, characterized in that the memory has stored therein a computer program, the processor being arranged to execute the method of any of claims 1 to 7 by means of the computer program.
CN202010507215.8A 2020-06-05 2020-06-05 Device connection method and device, storage medium and electronic device Active CN111757275B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010507215.8A CN111757275B (en) 2020-06-05 2020-06-05 Device connection method and device, storage medium and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010507215.8A CN111757275B (en) 2020-06-05 2020-06-05 Device connection method and device, storage medium and electronic device

Publications (2)

Publication Number Publication Date
CN111757275A true CN111757275A (en) 2020-10-09
CN111757275B CN111757275B (en) 2022-06-03

Family

ID=72675859

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010507215.8A Active CN111757275B (en) 2020-06-05 2020-06-05 Device connection method and device, storage medium and electronic device

Country Status (1)

Country Link
CN (1) CN111757275B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112866101A (en) * 2021-01-07 2021-05-28 珠海格力电器股份有限公司 Equipment networking method and device, electronic equipment and storage medium

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104978655A (en) * 2014-04-11 2015-10-14 上海智向信息科技有限公司 Near field payment connection and data exchange method and near field payment connection and data exchange system
CN104980987A (en) * 2014-04-08 2015-10-14 诺基亚技术有限公司 Method, apparatus, and computer program product for seamless switching of communication connection
CN105262512A (en) * 2015-09-17 2016-01-20 小米科技有限责任公司 Method and device for host switching
CN106376097A (en) * 2016-08-31 2017-02-01 杭州华三通信技术有限公司 Mesh connection establishing method and device
CN106535323A (en) * 2016-10-25 2017-03-22 广州创想科技股份有限公司 Method and device for selecting Bluetooth BLE communication device where Bluetooth bracelet is located
CN106713068A (en) * 2016-12-12 2017-05-24 上海斐讯数据通信技术有限公司 Intelligent terminal WIFI network display control method and system and intelligent terminal
CN108834164A (en) * 2018-04-17 2018-11-16 中兴通讯股份有限公司 WiFi connection control method, device and equipment, storage medium
CN109417758A (en) * 2016-06-27 2019-03-01 华为技术有限公司 A kind of method and terminal of bluetooth connection

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104980987A (en) * 2014-04-08 2015-10-14 诺基亚技术有限公司 Method, apparatus, and computer program product for seamless switching of communication connection
CN104978655A (en) * 2014-04-11 2015-10-14 上海智向信息科技有限公司 Near field payment connection and data exchange method and near field payment connection and data exchange system
CN105262512A (en) * 2015-09-17 2016-01-20 小米科技有限责任公司 Method and device for host switching
CN109417758A (en) * 2016-06-27 2019-03-01 华为技术有限公司 A kind of method and terminal of bluetooth connection
CN106376097A (en) * 2016-08-31 2017-02-01 杭州华三通信技术有限公司 Mesh connection establishing method and device
CN106535323A (en) * 2016-10-25 2017-03-22 广州创想科技股份有限公司 Method and device for selecting Bluetooth BLE communication device where Bluetooth bracelet is located
CN106713068A (en) * 2016-12-12 2017-05-24 上海斐讯数据通信技术有限公司 Intelligent terminal WIFI network display control method and system and intelligent terminal
CN108834164A (en) * 2018-04-17 2018-11-16 中兴通讯股份有限公司 WiFi connection control method, device and equipment, storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112866101A (en) * 2021-01-07 2021-05-28 珠海格力电器股份有限公司 Equipment networking method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN111757275B (en) 2022-06-03

Similar Documents

Publication Publication Date Title
WO2021082903A1 (en) Network slice selection method and related product
CN110831075A (en) Data transmission method and device and service switching method and device
US8804528B2 (en) Method of selecting wireless communication path
EP3069542A1 (en) Server aided nan cluster merging
CN105392185B (en) A kind of networking method of smart machine, apparatus and system
US10893573B2 (en) D2D communication method, remote user equipment, and relay user equipment
CN105120507A (en) Data packet monitoring method and system
CN111510922B (en) Wireless network access control method, device and system
JP2022537239A (en) Method, terminal, system and network access equipment for receiving and transmitting data in wireless LAN
US20080032684A1 (en) Radio communication control device, radio communication control system, and radio communication control method
CN112671904B (en) Method and device for transmitting equipment state information, storage medium and electronic device
US10051561B2 (en) Methods and nodes for M2M communication
CN113630272B (en) Communication method and device
US10149134B2 (en) Near field discovery method, user equipment, and storage medium
CN114615151A (en) Message processing method and device
CN108370610A (en) Interference mitigation in dense grid network
US20170346891A1 (en) Communication method
CN111757275B (en) Device connection method and device, storage medium and electronic device
CN105656978A (en) Resource sharing method and device
CN107005464B (en) Method and device for processing service flow data packet
JP2014143461A (en) Radio base station, radio communication system using the same, and radio communication connection method
CN108174434B (en) Method, terminal and intelligent device for automatically switching communication modes
US11575601B2 (en) Network device and packet processing method using same
JP2018098699A (en) Communication control device, communication system, and communication method
CN109495918B (en) Data transmission method and device

Legal Events

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