WO2024037500A1 - 通信方法及相关装置 - Google Patents
通信方法及相关装置 Download PDFInfo
- Publication number
- WO2024037500A1 WO2024037500A1 PCT/CN2023/112905 CN2023112905W WO2024037500A1 WO 2024037500 A1 WO2024037500 A1 WO 2024037500A1 CN 2023112905 W CN2023112905 W CN 2023112905W WO 2024037500 A1 WO2024037500 A1 WO 2024037500A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- information
- broadcast
- communication
- ble
- version number
- Prior art date
Links
- 238000004891 communication Methods 0.000 title claims abstract description 247
- 230000006854 communication Effects 0.000 title claims abstract description 247
- 238000000034 method Methods 0.000 title claims abstract description 137
- 230000015654 memory Effects 0.000 claims description 42
- 238000012795 verification Methods 0.000 claims description 27
- 150000003839 salts Chemical class 0.000 claims description 15
- 238000004590 computer program Methods 0.000 claims description 10
- 230000006855 networking Effects 0.000 abstract description 60
- 230000008569 process Effects 0.000 description 49
- 238000012545 processing Methods 0.000 description 47
- 230000006870 function Effects 0.000 description 32
- 238000007726 management method Methods 0.000 description 16
- 230000002093 peripheral effect Effects 0.000 description 15
- 238000010586 diagram Methods 0.000 description 14
- 230000005236 sound signal Effects 0.000 description 13
- 238000001914 filtration Methods 0.000 description 11
- 238000010295 mobile communication Methods 0.000 description 11
- 238000005516 engineering process Methods 0.000 description 9
- 238000004422 calculation algorithm Methods 0.000 description 8
- 230000005540 biological transmission Effects 0.000 description 6
- 238000004364 calculation method Methods 0.000 description 6
- 230000001360 synchronised effect Effects 0.000 description 6
- 230000003993 interaction Effects 0.000 description 5
- 229920001621 AMOLED Polymers 0.000 description 4
- 230000000694 effects Effects 0.000 description 4
- 230000003287 optical effect Effects 0.000 description 4
- 230000001133 acceleration Effects 0.000 description 3
- 238000013528 artificial neural network Methods 0.000 description 3
- 230000008859 change Effects 0.000 description 3
- 230000009429 distress Effects 0.000 description 3
- 230000007246 mechanism Effects 0.000 description 3
- 238000011084 recovery Methods 0.000 description 3
- 230000009286 beneficial effect Effects 0.000 description 2
- 230000001413 cellular effect Effects 0.000 description 2
- 238000013500 data storage Methods 0.000 description 2
- 230000033001 locomotion Effects 0.000 description 2
- 230000007774 longterm Effects 0.000 description 2
- 230000005855 radiation Effects 0.000 description 2
- 230000002159 abnormal effect Effects 0.000 description 1
- 238000013459 approach Methods 0.000 description 1
- 230000003416 augmentation Effects 0.000 description 1
- 230000003190 augmentative effect Effects 0.000 description 1
- 230000007175 bidirectional communication Effects 0.000 description 1
- 230000002457 bidirectional effect Effects 0.000 description 1
- 238000013529 biological neural network Methods 0.000 description 1
- 210000004556 brain Anatomy 0.000 description 1
- 239000003795 chemical substances by application Substances 0.000 description 1
- 230000001149 cognitive effect Effects 0.000 description 1
- 230000000295 complement effect Effects 0.000 description 1
- 239000004020 conductor Substances 0.000 description 1
- 238000012790 confirmation Methods 0.000 description 1
- 238000013524 data verification Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 230000005484 gravity Effects 0.000 description 1
- 230000003862 health status Effects 0.000 description 1
- 230000001939 inductive effect Effects 0.000 description 1
- 230000000977 initiatory effect Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 210000002569 neuron Anatomy 0.000 description 1
- 238000005457 optimization Methods 0.000 description 1
- 230000008447 perception Effects 0.000 description 1
- 239000002096 quantum dot Substances 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
- 238000009877 rendering Methods 0.000 description 1
- 230000002441 reversible effect Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 230000003238 somatosensory effect Effects 0.000 description 1
- 230000006641 stabilisation Effects 0.000 description 1
- 238000011105 stabilization Methods 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W4/00—Services specially adapted for wireless communication networks; Facilities therefor
- H04W4/06—Selective distribution of broadcast services, e.g. multimedia broadcast multicast service [MBMS]; Services to user groups; One-way selective calling services
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W4/00—Services specially adapted for wireless communication networks; Facilities therefor
- H04W4/80—Services using short range communication, e.g. near-field communication [NFC], radio-frequency identification [RFID] or low energy communication
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W8/00—Network data management
- H04W8/22—Processing or transfer of terminal data, e.g. status or physical capabilities
- H04W8/24—Transfer of terminal data
-
- Y—GENERAL 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
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE 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/00—Reducing energy consumption in communication networks
- Y02D30/70—Reducing energy consumption in communication networks in wireless communication networks
Definitions
- the present application relates to the field of Bluetooth technology, and in particular to a communication method and related devices.
- Both parties will authenticate the identity of the device, negotiate a communication key, and then exchange device information on the generated communication key to implement networking between devices.
- the process of BLE connection, authentication and device information exchange takes a long time and takes up more Bluetooth resources. Based on this, how to quickly bring networking equipment online has become one of the current problems that need to be solved urgently.
- This application provides a communication method and related devices, which can realize rapid networking between devices.
- this application provides a communication method, which method includes:
- the first device receives a Bluetooth Low Energy BLE broadcast from the second device.
- the BLE broadcast includes a first field.
- the first field is used to carry the first device information version number of the second device.
- the first The device information version number is used to indicate the version of the current device information of the second device;
- the first device determines that the device information of the second device is stored in the first device, and the device information of the second device includes a second device information version number of the second device.
- the second device The information version number is used to indicate the version of the device information of the second device stored in the first device;
- the first device restores the device information of the second device stored in the first device.
- the first device information version number of the second device can be used to determine whether to restore the first device.
- the device information of the second device stored in the first device.
- the first device restores the first device information.
- the device information of the second device is stored in one device, which is helpful to speed up the networking process.
- the device information version number in this application can also be understood as a device information identifier or device information index, and the device information identifier or device information index is used to mark device information.
- the first device information identifier or the first device information index included in the BLE broadcast sent by the second device is used to mark the current device information of the second device
- the device information of the second device stored in the first device includes The second device information identifier or the second device information index is used to mark the device information of the second device stored in the first device.
- the method further includes:
- the first device sends a BLE establishment request to the second device to establish the second device and the first device.
- the first device receives device information of the second device from the second device through the BLE connection;
- the first device stores the device information of the second device from the second device.
- networking between devices can also be achieved by establishing a BLE connection to exchange device information of the devices.
- the BLE broadcast further includes a second field, the second field is used to carry device update information of the second device;
- the method also includes:
- the first device updates the second device according to the restored device information of the second device and the device update information of the second device. equipment information.
- the BLE broadcast may also include the device update information of the second device. Therefore, the first device can update the second device based on the restored device information of the second device and combined with the device update information of the second device. Compared with the process of exchanging the device information of the device by establishing a BLE connection, the networking speed can be accelerated.
- the device update information of the second device includes an information update part and a check value corresponding to the information update part;
- the first device updates the device information of the second device according to the recovered device information of the second device and the device update information of the second device, including:
- the first device performs integrity verification on the information update part according to the verification value
- the first device updates and stores the second device information according to the information update part and the device information of the second device stored in the second device. Device information for the device.
- the integrity of the information update part can be checked based on the check value, which can avoid the BLE broadcast being interrupted during the broadcast process.
- the occurrence of packet loss will help improve the reliability of the information update part carried in the BLE broadcast.
- the BLE broadcast also includes a broadcast encrypted salt value
- the device update information of the second device is based on the broadcast key of the second device, the information update part and the The ciphertext information encrypted by the check value corresponding to the information update part;
- the method further includes:
- the first device decrypts the ciphertext information according to the salt value of the broadcast encryption and the broadcast key of the second device, and obtains the information update part and a check value corresponding to the information update part.
- the security of the broadcast can be enhanced and attacks by attackers can be prevented.
- the BLE broadcast also includes a communication key short value list; the device information of the second device stored in the first device includes the second device and the first device. communication key;
- the method also includes:
- the first device determines a communication key short value corresponding to the communication key between the second device and the first device
- the first device uses the communication key between the second device and the first device stored in the first device.
- the key sends communication data to the second device.
- the communication key short value list can also be carried through BLE broadcast, where the communication key short value list includes short values corresponding to multiple communication keys.
- the first device when the first device receives the BLE broadcast, it can calculate the communication key between the second device and the first device stored in the first device according to the same calculation method to obtain a short value, and traverse the BLE broadcast. Also includes whether the calculated short value is included in the communication key short value list. Specifically, when a short value is calculated and included in the communication key short value list, the first device can resume communication between the first device and the second device (that is, the first device can use the second stored in the first device. The communication key between the device and the first device sends communication data to the second device), which not only improves security, but also improves communication efficiency to a certain extent.
- the device information of the second device stored in the first device includes a communication key between the second device and the first device;
- the method also includes:
- the first device uses the communication key between the second device and the first device stored in the first device to send communication data to the second device.
- the first device when it is determined that the first device information version number is the same as the second device information version number, the first device immediately resumes communication between the first device and the second device (that is, the first device uses the first device
- the communication key between the second device and the first device stored in the device is used to send communication data to the second device), which can improve communication efficiency.
- the BLE broadcast also includes a short value of the account information of the second device and/or a short value of the device identification of the second device;
- the method further includes:
- the first device determines whether there is a trust relationship between the second device and the first device based on the short value of the account information of the second device and/or the short value of the device identification of the second device;
- the first device determines that there is a trust relationship between the second device and the first device, the first device determines that the device information of the second device is stored in the first device.
- the first device determines that there is a trust relationship between the second device and the first device, it then determines that the device information of the second device is stored in the first device, which can avoid being awakened by uninterested BLE broadcasts. and notifications.
- the method further includes:
- the first device sends a BLE broadcast, and the BLE broadcast sent by the first device is used by the second device to restore and update the device information of the first device stored in the second device.
- the first device can also use the method of sending BLE broadcast to help the second device recover and update the device information of the first device stored in the second device. Therefore, it is beneficial to improve the performance of the first device in the second device. Online speed in .
- this application provides a communication method, which method includes:
- the second device sends a low-power Bluetooth BLE broadcast to the first device.
- the BLE broadcast includes a first field.
- the first field is used to carry the first device information version number of the second device.
- the first device The information version number is used to indicate the version of the current device information of the second device.
- the method further includes:
- the second device sends the device information of the second device to the first device through the BLE connection.
- the BLE broadcast further includes a second field, and the second field is used to carry device update information of the second device.
- the device update information of the second device includes an information update part and a check value corresponding to the information update part.
- the BLE broadcast also includes a broadcast encrypted salt value
- the device update information of the second device is based on the broadcast key of the second device, the information update part and the The ciphertext information encrypted by the check value corresponding to the information update part.
- the method further includes:
- the second device receives communication data from the first device.
- the method further includes:
- the second device receives the BLE broadcast from the first device, and the second device restores and updates the first device's information stored in the second device based on the BLE broadcast sent by the first device.
- Device Information
- this application provides a communication device, which is a first device.
- the device includes:
- a Bluetooth module configured to receive a low-power Bluetooth BLE broadcast from a second device.
- the BLE broadcast includes a first field, and the first field is used to carry the first device information version number of the second device.
- the first device information version number is used to indicate the version of the current device information of the second device;
- a processing module configured to determine that the storage module of the first device stores device information of the second device, and the device information of the second device includes a second device information version number of the second device;
- the second device information version number is used to indicate the version of the device information of the second device stored in the storage module;
- the processing module restores the device information of the second device stored in the storage module.
- the processing module is also configured to send a message to the second device through the Bluetooth module if the first device information version number and the second device information version number are not the same.
- BLE establishment request to establish a BLE connection between the second device and the first device;
- the Bluetooth module is also configured to receive device information of the second device from the second device through the BLE connection;
- the storage module is used to store the device information of the second device from the second device.
- the BLE broadcast further includes a second field, the second field is used to carry device update information of the second device;
- the processing module is also used to:
- the device update information of the second device includes an information update part and a check value corresponding to the information update part;
- the processing module When updating the device information of the second device based on the recovered device information of the second device and the device update information of the second device, the processing module is used to:
- the device information of the second device is updated and stored according to the information update part and the device information of the second device stored in the second device.
- the BLE broadcast also includes a broadcast encrypted salt value
- the device update information of the second device is based on the broadcast key of the second device, the information update part and the The ciphertext information encrypted by the check value corresponding to the information update part;
- the processing module Before performing integrity verification on the information update part according to the verification value, the processing module is used to:
- the ciphertext information is decrypted according to the salt value of the broadcast encryption and the broadcast key of the second device to obtain the information update part and a check value corresponding to the information update part.
- the BLE broadcast also includes a communication key short value list;
- the device information of the second device stored in the storage module includes the difference between the second device and the first device. communication key;
- the processing module is also used to:
- the first device determines a communication key short value corresponding to the communication key between the second device and the first device
- the communication key short value list includes the communication key short value
- the communication key between the second device and the first device stored in the storage module is used through the Bluetooth module. Send communication data to the second device.
- the device information of the second device stored in the storage module includes a communication key between the second device and the first device;
- the Bluetooth module is also used for:
- the communication data is sent to the second device using the communication key between the second device and the first device stored in the storage module.
- the BLE broadcast also includes a short value of the account information of the second device and/or a short value of the device identification of the second device;
- the processing module is further configured to:
- the first device determines that there is a trust relationship between the second device and the first device, it is determined that the device information of the second device is stored in the first device.
- the Bluetooth module is also used to:
- Send a BLE broadcast which is used by the second device to restore and update the device information of the first device stored in the second device.
- this application provides a communication device, which includes:
- a Bluetooth module configured to send a low-power Bluetooth BLE broadcast to the first device.
- the BLE broadcast includes a first field.
- the first field is used to carry the first device information version number of the second device.
- the third A device information version number is used to indicate the version of the current device information of the second device.
- the Bluetooth module is also used to:
- the BLE broadcast further includes a second field, and the second field is used to carry device update information of the second device.
- the device update information of the second device includes an information update part and a check value corresponding to the information update part.
- the BLE broadcast also includes a broadcast encrypted salt value
- the device update information of the second device is based on the broadcast key of the second device, the information update part and the The ciphertext information encrypted by the check value corresponding to the information update part.
- the Bluetooth module is also used to:
- the Bluetooth module is also used to:
- the device also includes a processing module:
- the processing module is configured to restore and update the information of the first device stored in the storage module of the second device according to the BLE broadcast. Device Information.
- the present application provides an electronic device, including one or more processors, one or more Bluetooth modules and one or more memories.
- the one or more memories, the one or more Bluetooth modules and the one or more processors are coupled, the one or more memories are used to store computer program code, the computer program code includes computer instructions, when the one or more processors execute the computer When the instruction is issued, the electronic device is caused to execute the communication method in any of the possible implementations of any of the above aspects.
- embodiments of the present application provide a computer storage medium that includes computer instructions.
- the computer instructions When the computer instructions are run on an electronic device, the electronic device causes the electronic device to perform the communication method in any of the possible implementations of any of the above aspects.
- embodiments of the present application provide a computer program product.
- the computer program product When the computer program product is run on a computer, it causes the computer to execute the communication method in any of the possible implementations of any of the above aspects.
- FIG. 1 is a schematic diagram of the wireless communication system provided by this application.
- FIG. 2 is a schematic diagram of the distributed communication architecture provided by this application.
- Figure 3 is a schematic flow chart of networking between devices
- Figure 4 is a schematic structural diagram of an electronic device provided by this application.
- Figure 5 is a schematic structural diagram of another electronic device provided by an embodiment of the present application.
- Figure 6 is a schematic flow chart of a BLE-based communication method provided by an embodiment of the present application.
- Figure 7 is a schematic diagram of communication recovery between devices provided by an embodiment of the present application.
- Figure 8 is another schematic flow chart of the BLE-based communication method provided by the embodiment of the present application.
- Figure 9 is a schematic structural diagram of a communication device provided by an embodiment of the present application.
- Figure 10 is a schematic structural diagram of another communication device provided by an embodiment of the present application.
- first and second are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the quantity of indicated technical features. Therefore, features defined as “first” and “second” may explicitly or implicitly include one or more of these features. In the description of the embodiments of this application, unless otherwise specified, "plurality” means two or more.
- the embodiments of this application provide a communication method and related devices based on low-power Bluetooth.
- electronic devices do not need to perform processes such as BLE connection establishment, authentication, and information exchange. Instead, they exchange devices through BLE broadcasts. information.
- Implementing this application can achieve rapid online deployment of networking equipment.
- the wireless communication system may include multiple electronic devices. Among them, each electronic device can communicate with other electronic devices in the wireless communication system based on BLE.
- the embodiments of this application do not specifically limit the type of electronic device.
- the electronic device can be a mobile phone, a tablet computer, a personal digital assistant (PDA), a wearable device (such as a Bluetooth headset), a laptop computer (laptop) ) and other portable electronic devices, or it can also be non-portable electronic devices such as desktop computers.
- Examples of electronic devices include, but are not limited to, electronic devices equipped with iOS, Android, Microsoft or other operating systems.
- the electronic device in the embodiment of the present application may also be called a terminal device, which may be a device with wireless transceiver functions. Specifically, it may refer to user equipment (UE), access terminal, subscriber unit, User station, mobile station, customer-premises equipment (CPE), remote station, remote terminal, mobile device, user terminal, wireless communication equipment, user agent or user device.
- UE user equipment
- CPE customer-premises equipment
- the terminal device may also be a satellite phone, a cellular phone, a smartphone, a wireless data card, a wireless modem, a machine type communications device, a cordless phone, a session initiation protocol (SIP) phone, a wireless local loop (wireless local loop (WLL) station, personal digital assistant (PDA), handheld device with wireless communication function, computing device or other processing device connected to a wireless modem, vehicle-mounted equipment, communication equipment carried on high-altitude aircraft Information equipment, wearable devices, drones, robots, smart point of sale (POS) machines, terminals in device-to-device (D2D) communication, vehicle to everything, Terminals in V2X), virtual reality (VR) terminal equipment, augmented reality (AR) terminal equipment, wireless terminals in industrial control (industrial control), wireless terminals in self-driving (self driving) , wireless terminals in remote medical, wireless terminals in smart grid, wireless terminals in transportation safety, wireless terminals in smart city, smart home ) or terminal equipment in future communication networks, etc., are not limited by
- the device used to implement the function of the terminal device may be a terminal device; it may also be a device that can support the terminal device to implement the function, such as a chip system.
- the device can be installed in a terminal device or used in conjunction with the terminal device.
- the chip system may be composed of chips, or may include chips and other discrete devices.
- Figure 2 is a schematic diagram of the distributed communication architecture provided by this application.
- the distributed communication service provides other distributed communication services based on the Bluetooth chip, Bluetooth driver and Bluetooth service. Services and other Apps provide communication capabilities. in:
- Bluetooth chip realizes protocol interaction between Bluetooth protocol and air interface.
- Bluetooth driver implements the functions of the Bluetooth driver according to the device architecture and completes the interaction process with the Bluetooth chip.
- Bluetooth service Provides basic Bluetooth communication capabilities.
- Distributed communication service Based on the Bluetooth service, it provides communication capabilities such as discovery, connection, and transmission for other upper-layer distributed services and apps.
- each electronic device in a wireless communication system usually needs to be networked before communicating. Specifically, when an electronic device searches for peripheral electronic devices, it usually needs to send a networking broadcast. Then the peripheral electronic device can establish a BLE connection with the electronic device based on the received networking broadcast. Furthermore, both parties of the electronic device will communicate with the electronic device. The device identity is authenticated and a communication key is negotiated, and then electronic device information is exchanged on the generated communication key to realize networking between electronic devices.
- FIG 3 is a schematic flow chart of networking between devices.
- the wireless communication system includes electronic device A (referred to as device A), electronic device B (referred to as device B), and electronic device C (referred to as device C).
- each electronic device will set its own broadcast message filtering rules after startup. Only when the received BLE broadcast meets the broadcast message filtering rules, it will be notified for processing. In other words, by setting broadcast message filtering rules, a device can prevent the device from being woken up and notified by BLE broadcasts that it does not care about.
- networking broadcasts can be broadcast to peripheral devices through the BLE broadcast mechanism.
- networking broadcasts can also be described as BLE broadcasts.
- the BLE broadcast contains information about the device (i.e. device A), such as the account information of the device, device identification (Identity, ID), device type, and network broadcast type and other information.
- the account information included in the BLE broadcast sent by device A is usually a short value of device A's account information
- the device ID included in the BLE broadcast is usually a short value of device A's device ID.
- the network broadcast type includes whether to wake up the screen-off device, heartbeat type, message type, etc., which are not limited here.
- the peripheral device (such as device B and device C) determines that the BLE broadcast satisfies its broadcast message filtering rules, then the peripheral device will use the information of device A in the BLE broadcast and the stored local Device information, decide whether to network with device A.
- the following mainly takes the interaction between device A and device B as an example for schematic explanation.
- device B can check whether device A has been online in device B based on the received information of device A and the information of its own device. If the network is online, it means that device A has completed networking with device B. Otherwise, check whether device B meets the networking conditions with device A. If device B determines that it meets the networking conditions with device A that sends the broadcast, for example, when the short value of device A's account information is the same as the short value of device B's account information. , or when there is other trust relationship between device A and device B, then device B will initiate a BLE connection request to device A to request the establishment of a BLE connection.
- device A and device B authenticate and derive a communication key for data verification during subsequent transmission.
- Encryption means that device A and device B can subsequently communicate using the communication key, that is, exchange detailed information about each other's devices on the encrypted channel, such as exchanging the complete device ID of each other's device, complete account information, version number of the device, Bluetooth version number, device name, device Internet protocol (IP) address information, device media access control (MAC) address information, device distributed communication capability information, device-supported transmission protocols, One or more of the software version information supported by the device, the size of the transmission buffer, and other information are not limited here.
- IP Internet protocol
- MAC media access control
- device A After device A continues to send BLE broadcasts for a period of time, it will stop sending BLE broadcasts. It is understandable that if device A continues to send BLE broadcasts, device A's power resources will continue to be consumed.
- this application provides a communication method and related devices based on low-power Bluetooth, which can improve the efficiency of device networking and online.
- Figure 4 is a schematic structural diagram of an electronic device provided by this application. As shown in Figure 4, the electronic device may include the following modules:
- Discovery module responsible for sending and receiving broadcasts.
- Connection module Responsible for connecting to the specified device and receiving connections.
- Transmission module Based on the connection channel, it provides the ability to send and receive data.
- Device information storage module Stores device information locally, including peer device and local device information.
- the content includes basic information of the device and communication key information.
- Device information recovery module Based on broadcast information and stored device information, the communication key is restored to achieve rapid online launch.
- Device information synchronization complete information exchange and difference update on the secure channel.
- Authentication module Responsible for authenticating devices, negotiating or deriving communication keys, and managing communication keys between devices.
- FIG. 5 is a schematic structural diagram of another electronic device provided by an embodiment of the present application.
- the electronic device 100 may be an electronic device in the wireless communication system shown in FIG. 1 .
- the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, and a battery 142 , Antenna 1, Antenna 2, mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone interface 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193 , display screen 194, and subscriber identification module (subscriber identification module, SIM) card interface 195, etc.
- SIM subscriber identification module
- the sensor module 180 may include a pressure sensor 180A, a gyro sensor 180B, an air pressure sensor 180C, an acceleration sensor 180E, a distance sensor 180F, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, etc.
- the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100 .
- the electronic device 100 may include more or fewer components than shown in the figures, or some components may be combined, some components may be separated, or some components may be arranged differently.
- the components illustrated may be implemented in hardware, software, or a combination of software and hardware.
- the processor 110 may include one or more processing modules.
- the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processing unit (GPU), and an image signal processor. (image signal processor, ISP), controller, memory, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural-network processing unit (NPU) wait.
- application processor application processor, AP
- modem processor graphics processing unit
- GPU graphics processing unit
- image signal processor image signal processor
- ISP image signal processor
- controller memory
- video codec digital signal processor
- DSP digital signal processor
- baseband processor baseband processor
- NPU neural-network processing unit
- different processing modules can be independent devices or integrated in one or more processors.
- the controller may be the nerve center and command center of the electronic device 100 .
- the controller can generate operation control signals based on the instruction operation code and timing signals to complete the control of fetching and executing instructions.
- the processor 110 may also be provided with a memory for storing instructions and data.
- the memory in processor 110 is cache memory. This memory may hold instructions or data that have been recently used or recycled by processor 110 . If the processor 110 needs to use the instructions or data again, it can be called directly from the memory. Repeated access is avoided and the waiting time of the processor 110 is reduced, thus improving the efficiency of the system.
- the memory stores instructions that cause the electronic device to execute the BLE-based communication method provided by the embodiment of the present application. For the BLE-based communication method provided by the present application, please refer to the relevant description of subsequent embodiments.
- the memory can also store emergency help information preset by the user.
- processor 110 may include one or more interfaces.
- Interfaces may include integrated circuit (inter-integrated circuit, I2C) interface, integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, pulse code modulation (PCM) interface, universal asynchronous receiver and transmitter (universal asynchronous receiver/transmitter, UART) interface, mobile industry processor Interface (mobile industry processor interface, MIPI), general-purpose input/output (GPIO) interface, subscriber identity module (SIM) interface, and/or universal serial bus (USB) ) interface, etc.
- I2C integrated circuit
- I2S integrated circuit built-in audio
- PCM pulse code modulation
- UART universal asynchronous receiver and transmitter
- MIPI mobile industry processor Interface
- GPIO general-purpose input/output
- SIM subscriber identity module
- USB universal serial bus
- the I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (derail clock line, SCL).
- processor 110 may include multiple sets of I2C buses.
- the processor 110 can separately couple the touch sensor 180K, charger, flash, camera 193, etc. through different I2C bus interfaces.
- the processor 110 can be coupled to the touch sensor 180K through an I2C interface, so that the processor 110 and the touch sensor 180K communicate through the I2C bus interface to implement the touch function of the electronic device 100 .
- the I2S interface can be used for audio communication.
- processor 110 may include multiple sets of I2S buses.
- the processor 110 can be coupled with the audio module 170 through the I2S bus to implement communication between the processor 110 and the audio module 170 .
- the audio module 170 can transmit audio signals to the wireless communication module 160 through the I2S interface to implement the function of answering calls through a Bluetooth headset.
- the PCM interface can also be used for audio communications to sample, quantize and encode analog signals.
- the audio module 170 and the wireless communication module 160 may be coupled through a PCM bus interface.
- the audio module 170 can also transmit audio signals to the wireless communication module 160 through the PCM interface to implement the function of answering calls through a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
- the UART interface is a universal serial data bus used for asynchronous communication.
- the bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication.
- a UART interface is generally used to connect the processor 110 and the wireless communication module 160 .
- the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to implement the Bluetooth function.
- the audio module 170 can transmit audio signals to the wireless communication module 160 through the UART interface to implement the function of playing music through a Bluetooth headset.
- the MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193 .
- MIPI interfaces include camera serial interface (CSI), display serial interface (DSI), etc.
- the processor 110 and the camera 193 communicate through the CSI interface to implement the shooting function of the electronic device 100 .
- the processor 110 and the display screen 194 communicate through the DSI interface to implement the display function of the electronic device 100 .
- the GPIO interface can be configured through software.
- the GPIO interface can be configured as a control signal or as a data signal.
- the GPIO interface can be used to connect the processor 110 with the camera 193, display screen 194, wireless communication module 160, audio module 170, sensor module 180, etc.
- the GPIO interface can also be configured as an I2C interface, I2S interface, UART interface, MIPI interface, etc.
- the USB interface 130 is an interface that complies with the USB standard specification, and may be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc.
- the USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transmit data between the electronic device 100 and peripheral devices. It can also be used to connect headphones to play audio through them. This interface can also be used to connect other electronic devices, such as AR devices, etc.
- the interface connection relationships between the modules illustrated in the embodiments of the present application are only schematic illustrations and do not constitute a structural limitation of the electronic device 100 .
- the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
- the charging management module 140 is used to receive charging input from the charger.
- the charger can be a wireless charger or a wired charger.
- the charging management module 140 may receive charging input from the wired charger through the USB interface 130 .
- the charging management module 140 may receive wireless charging input through the wireless charging coil of the electronic device 100 . While the charging management module 140 charges the battery 142, it can also provide power to the electronic device through the power management module 141.
- the power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110.
- the power management module 141 receives input from the battery 142 and/or the charging management module 140, and supplies power to the processor 110, internal memory 121, external memory, display screen 194, camera 193, wireless communication module 160, etc.
- the power management module 141 can also be used to monitor battery capacity, battery cycle times, battery health status (leakage, impedance) and other parameters.
- the power management module 141 may also be provided in the processor 110 .
- the power management module 141 and the charging management module 140 may also be provided in the same device.
- the wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
- Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals.
- Each antenna in electronic device 100 may be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example: Antenna 1 can be reused as a diversity antenna for a wireless LAN. In other embodiments, antennas may be used in conjunction with tuning switches.
- the mobile communication module 150 can provide solutions for wireless communication including 2G/3G/4G/5G applied on the electronic device 100 .
- the mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc.
- the mobile communication module 150 can receive electromagnetic waves from the antenna 1, filter and amplify the received electromagnetic waves, and transmit them to modulation and demodulation processing. Demodulator.
- the mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves through the antenna 1 for radiation.
- at least part of the functional modules of the mobile communication module 150 may be disposed in the processor 110 .
- at least part of the functional modules of the mobile communication module 150 and at least part of the modules of the processor 110 may be provided in the same device.
- a modem processor may include a modulator and a demodulator.
- the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal.
- the demodulator is used to demodulate 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 application processor outputs sound signals through audio devices (not limited to speaker 170A, receiver 170B, etc.), or displays images or videos through display screen 194.
- the modem processor may be a stand-alone device.
- the modem processor may be independent of the processor 110 and may be provided in the same device as the mobile communication module 150 or other functional modules.
- the wireless communication module 160 can provide applications on the electronic device 100 including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) network), Bluetooth (bluetooth, BT), and global navigation satellites.
- WLAN wireless local area networks
- WiFi wireless fidelity
- BT Bluetooth
- global navigation satellites System (global navigation satellite system, GNSS), frequency modulation (frequency modulation, FM), near field communication technology (near field communication, NFC), infrared technology (infrared, IR) and other wireless communication solutions.
- the wireless communication module 160 may be one or more devices integrating at least one communication processing module.
- the wireless communication module 160 receives electromagnetic waves via the antenna 2 , frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110 .
- the wireless communication module 160 can also receive the signal to be sent from the processor 110, frequency modulate it, amplify it, and convert it into electromagnetic waves through the antenna 2 for radiation.
- the electronic device 100 supports BLE and can communicate with other devices based on BLE.
- the electronic device 100 may send or scan the BLE broadcast provided by the embodiment of the present application on the BLE broadcast channel.
- the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology.
- the wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), broadband 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), BT, GNSS, WLAN, NFC , FM, and/or IR technology, etc.
- the GNSS may include global positioning system (GPS), global navigation satellite system (GLONASS), Beidou navigation satellite system (BDS), quasi-zenith satellite system (quasi) -zenith satellite system (QZSS) and/or satellite based augmentation systems (SBAS).
- GPS global positioning system
- GLONASS global navigation satellite system
- BDS Beidou navigation satellite system
- QZSS quasi-zenith satellite system
- SBAS satellite based augmentation systems
- the electronic device 100 can obtain its own location information through wireless communication technology.
- the electronic device 100 implements display functions through a GPU, a display screen 194, an application processor, and the like.
- the GPU is an image processing microprocessor and is connected to the display screen 194 and the application processor. GPUs are used to perform mathematical and geometric calculations for graphics rendering.
- Processor 110 may include one or more GPUs that execute program instructions to generate or alter display information.
- the display screen 194 is used to display images, videos, etc.
- Display 194 includes a display panel.
- the display panel can use a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active matrix organic light emitting diode or an active matrix organic light emitting diode (active-matrix organic light emitting diode).
- LCD liquid crystal display
- OLED organic light-emitting diode
- AMOLED organic light-emitting diode
- FLED flexible light-emitting diode
- Miniled MicroLed, Micro-oLed, quantum dot light emitting diode (QLED), etc.
- the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
- the electronic device 100 can implement the shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, an application processor, and the like.
- the ISP is used to process the data fed back by the camera 193. For example, when taking a photo, the shutter is opened, the light is transmitted to the camera sensor through the lens, the optical signal is converted into an electrical signal, and the camera sensor passes the electrical signal to the ISP for processing, and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on image noise, brightness, etc. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, the ISP may be provided in the camera 193.
- Camera 193 is used to capture still images or video.
- the object passes through the lens to produce an optical image that is projected onto the photosensitive element.
- the photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor.
- CMOS complementary metal-oxide-semiconductor
- the photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to convert it into a digital image signal.
- ISP outputs digital image signals to DSP for processing.
- DSP converts digital image signals into standard RGB, YUV and other format image signals.
- the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.
- Digital signal processors are used to process digital signals. In addition to digital image signals, they can also process other digital signals. For example, when the electronic device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
- Video codecs are used to compress or decompress digital video.
- Electronic device 100 may support one or more video codecs. In this way, the electronic device 100 can play or record videos in multiple encoding formats, such as moving picture experts group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
- MPEG moving picture experts group
- MPEG2 MPEG2, MPEG3, MPEG4, etc.
- NPU is a neural network (NN) computing processor.
- NN neural network
- Intelligent cognitive applications of the electronic device 100 can be implemented through the NPU, such as image recognition, face recognition, speech recognition, text understanding, etc.
- the external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100.
- the external memory card communicates with the processor 110 through the external memory interface 120 to implement the data storage function. Such as saving music, videos, etc. files in external memory card.
- Internal memory 121 may be used to store computer executable program code, which includes instructions.
- the processor 110 executes instructions stored in the internal memory 121 to execute various functional applications and data processing of the electronic device 100 .
- the internal memory 121 may include a program storage area and a data storage area. Among them, the stored program area can store an operating system, at least one application program required for a function (such as a sound playback function, an image playback function, etc.).
- the storage data area may store data created during use of the electronic device 100 (such as audio data, phone book, etc.).
- the internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc.
- the electronic device 100 can implement audio functions through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone interface 170D, and the application processor. Such as music playback, recording, etc.
- the audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. Audio module 170 may also be used to encode and decode audio signals. In some embodiments, the audio module 170 may be provided in the processor 110 , or some functional modules of the audio module 170 may be provided in the processor 110 .
- Speaker 170A also called “speaker” is used to convert audio electrical signals into sound signals.
- the electronic device 100 can listen to music through the speaker 170A, or listen to hands-free calls.
- Receiver 170B also called “earpiece” is used to convert audio electrical signals into sound signals.
- the electronic device 100 answers a call or a voice message, the voice can be heard by bringing the receiver 170B close to the human ear.
- the receiver may be used to receive voice input by the user for sending a distress broadcast package.
- Microphone 170C also called “microphone” or “microphone” is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak close to the microphone 170C with the human mouth and input the sound signal to the microphone 170C.
- the electronic device 100 may be provided with at least one microphone 170C. In other embodiments, the electronic device 100 may be provided with two microphones 170C, which in addition to collecting sound signals, may also implement a noise reduction function. In other embodiments, the electronic device 100 can also be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify sound sources, and implement directional recording functions, etc. In some embodiments of the present application, the microphone may be used to receive voice input by the user for sending a distress broadcast package.
- the headphone interface 170D is used to connect wired headphones.
- the headphone interface 170D may be a USB interface 130, or may be a 3.5mm open mobile terminal platform (OMTP) standard interface, or a Cellular Telecommunications Industry Association of the USA (CTIA) standard interface.
- OMTP open mobile terminal platform
- CTIA Cellular Telecommunications Industry Association of the USA
- the pressure sensor 180A is used to sense pressure signals and can convert the pressure signals into electrical signals.
- pressure sensor 180A may be disposed on display screen 194 .
- pressure sensors 180A there are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc.
- a capacitive pressure sensor may include at least two parallel plates of conductive material.
- the electronic device 100 determines the intensity of the pressure based on the change in capacitance.
- the electronic device 100 detects the intensity of the touch operation according to the pressure sensor 180A.
- the electronic device 100 may also calculate the touched position based on the detection signal of the pressure sensor 180A.
- touch operations acting on the same touch location but with different touch operation intensities may correspond to different operation instructions. For example: when a touch operation with a touch operation intensity less than the first pressure threshold is applied to the short message application icon, an instruction to view the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold is applied to the short message application icon, an instruction to create a new short message is executed.
- the pressure sensor may be used to detect a gesture input by the user for sending a distress broadcast package.
- the gyro sensor 180B may be used to determine the motion posture of the electronic device 100 .
- the angular velocity of electronic device 100 about three axes ie, x, y, and z axes
- the gyro sensor 180B can be used for image stabilization. For example, when the shutter is pressed, the gyro sensor 180B detects the angle at which the electronic device 100 shakes, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to offset the shake of the electronic device 100 through reverse movement to achieve anti-shake.
- the gyro sensor 180B can also be used for navigation and somatosensory game scenes.
- Air pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device 100 calculates the altitude through the air pressure value measured by the air pressure sensor 180C to assist positioning and navigation.
- the acceleration sensor 180E can detect the acceleration of the electronic device 100 in various directions (generally three axes). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of electronic devices and be used in horizontal and vertical screen switching, pedometer and other applications.
- Distance sensor 180F for measuring distance.
- Electronic device 100 can measure distance via infrared or laser. In some embodiments, when shooting a scene, the electronic device 100 may utilize the distance sensor 180F to measure distance to achieve fast focusing.
- the ambient light sensor 180L is used to sense ambient light brightness.
- the electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness.
- the ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures.
- the ambient light sensor 180L can also cooperate with a proximity light sensor (not shown in the figure) to detect whether the electronic device 100 is in the pocket to prevent accidental touching.
- Fingerprint sensor 180H is used to collect fingerprints.
- the electronic device 100 can use the collected fingerprint characteristics to achieve fingerprint unlocking, access to application locks, fingerprint photography, fingerprint answering of incoming calls, etc.
- Temperature sensor 180J is used to detect temperature.
- the electronic device 100 utilizes the temperature detected by the temperature sensor 180J to execute the temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold, the electronic device 100 reduces the performance of a processor located near the temperature sensor 180J in order to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 heats the battery 142 to prevent the low temperature from causing the electronic device 100 to shut down abnormally. In some other embodiments, when the temperature is lower than another threshold, the electronic device 100 performs boosting on the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.
- Touch sensor 180K also called “touch panel”.
- the touch sensor 180K can be disposed on the display screen 194.
- 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 used to detect a touch operation on or near the touch sensor 180K.
- the touch sensor can pass the detected touch operation to the application processor to determine the touch event type.
- Visual output related to the touch operation may be provided through display screen 194 .
- the touch sensor 180K may also be disposed on the surface of the electronic device 100 at a location different from that of the display screen 194 .
- the buttons 190 include a power button, a volume button, etc.
- Key 190 may be a mechanical key. It can also be a touch button.
- the electronic device 100 may receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 100 .
- the motor 191 can generate vibration prompts.
- the motor 191 can be used for vibration prompts for incoming calls and can also be used for touch vibration feedback.
- touch operations for different applications can correspond to different vibration feedback effects.
- the motor 191 can also respond to different vibration feedback effects for touch operations in different areas of the display screen 194 .
- Different application scenarios such as time reminders, receiving information, alarm clocks, games, etc.
- the touch vibration feedback effect can also be customized.
- the indicator 192 may be an indicator light, which may be used to indicate charging status, power changes, or may be used to indicate messages, missed calls, notifications, etc.
- the SIM card interface 195 is used to connect a SIM card.
- the SIM card can be connected to or separated from the electronic device 100 by inserting it into the SIM card interface 195 or pulling it out from the SIM card interface 195 .
- the electronic device 100 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1.
- SIM card interface 195 can support Nano SIM card, Micro SIM card, SIM card, etc. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the plurality of cards may be the same or different.
- the SIM card interface 195 is also compatible with different types of SIM cards.
- the SIM card interface 195 is also compatible with external memory cards.
- the electronic device 100 interacts with the network through the SIM card to implement functions such as calls and data communications.
- the electronic device 100 uses an eSIM, that is, an embedded SIM card.
- the eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100 .
- the software system of the above-mentioned electronic device 100 can adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture, etc., which are not limited here.
- the device information version number described in this application below can also be understood as a device information identifier or device information index, and the device information identifier or device information index is used to mark device information.
- the device information identifier or device information index included in the BLE broadcast can be used to mark the current device information of the broadcast sender of the BLE broadcast.
- the device information identifier or device information index included in the device information of another device stored in a certain device is used to mark the device information of another device stored in the device.
- the specific expression form of the device information version number or device information identification or device information index may be numbers, characters or strings, etc., or it may also be a mixed form composed of numbers and characters, etc., which is determined according to the actual scenario. There are no restrictions here.
- the following embodiments of the present application mainly take the device information version number as an example for schematic description.
- Figure 6 is a schematic flow chart of a BLE-based communication method provided by an embodiment of the present application.
- the electronic device A in Figure 6 (Device A for short) is equivalent to the second device
- electronic device B (Device B for short) is equivalent to the first device.
- the method may include the following steps:
- Device A and device B respectively set broadcast packet filtering rules.
- the broadcast packet filtering rules of a certain device may generally include information such as the account information of the device that the device is concerned about and/or the device ID of the device it is concerned about, which is not limited here. It is understandable that the account information of the device that the device cares about included in the broadcast packet filtering rules set by a certain device is usually a short value of the account information, and the device ID is usually a short value of the device ID, which is not limited here.
- the broadcast packet filtering rule of device B includes the device ID of device A, the device ID of device C, and the device ID of device D. Then when device B receives a BLE broadcast from device A, device B You can check whether device A has been online in device B based on the device ID of device A extracted from the BLE broadcast and the information stored in the device, such as broadcast message filtering rules. If the network is online, it means that device A has completed networking with device B, so device B can ignore this BLE broadcast. Otherwise, device B checks whether device B and device A meet the networking conditions or whether device B and device A have a trust relationship.
- device B can ignore this BLE broadcast; if device B and device A meet the networking conditions or have a trust relationship, for example, when device A’s account information When the short value is the same as the short value of device B's account information, or when there is other trust relationship between device A and device B, device B further determines the next operation method.
- the broadcast message filtering rules of device B include the information of device C and the information of device D. Then when device B receives the BLE broadcast from device A, because device A is not of concern to device B, device, therefore, Device B ignores this BLE advertisement.
- S602. Device A sends a BLE broadcast.
- device A can broadcast and send BLE broadcasts to peripheral devices through the BLE broadcast mechanism.
- the following schematic explanation mainly takes the peripheral device of device A as device B as an example. Accordingly, device B receives the BLE broadcast from device A.
- the length of the BLE broadcast involved in the embodiment of this application can be 31 bytes, etc., which is determined based on the actual scenario, and is not limited here.
- the BLE broadcast may include device A's information and device A's device update information. It should be noted that the BLE broadcast can include multiple fields, and each field is used to carry different information. For example, the first field in the BLE broadcast is used to carry the device information version number of the device, and the second field is used to carry the device's device information version number. Equipment update information, etc., are not limited here.
- the information of device A includes one or more of the following information: the short value of the account information of device A, the short value of the device ID of device A, and the device information version number of device A (i.e., the first device information version number ), broadcasting encrypted salt value and other information.
- the length of the short value of the account information of device A involved in this application is usually 2 bytes
- the length of the short value of the device ID of device A is usually 8 bytes
- the length of the device information version number of device A is usually 2 bytes.
- the length of the salt value for broadcast encryption is usually 2 bytes, etc., which is determined based on the actual scenario and is not limited here.
- the device update information of device A includes the updated part (or understood as the difference part, or differential part) of the information of device A when device A broadcasts this time compared to the first broadcast of device A, and the verification corresponding to the updated part. value.
- the Wi-Fi of device A was not turned on, the screen of device A was not turned on, and the flashlight switch of device A was turned off.
- the Wi-Fi of device A was turned on and the device A has turned on the screen, and the flashlight switch on device A is still off.
- the updated part of device A's information is that Wi-Fi has been turned on, and device A has turned on the screen.
- the length of the check value corresponding to the update part involved in this application is usually 1 byte.
- the device update information of device A can be plain text information (that is, the information update part of device A and the check value corresponding to the update part are both plain text information), or the device update information of device A can also be based on broadcast encryption.
- the key encrypts the ciphertext information of the information update part of device A and the check value corresponding to the update part.
- whether to encrypt the device update information of device A carried in the BLE broadcast sent by device A based on the broadcast key of device A is an optional step. Encryption is conducive to improving the security of the broadcast and preventing attackers from attacking. .
- the integrity check of the information update part of device A can be directly based on the verification value; if the device update information of device A is cipher text information, it is necessary to The ciphertext information is first decrypted based on the salt value of broadcast encryption and the broadcast key of device A, and then the integrity of the information update part of device A is verified based on the check value for subsequent processes.
- the following schematic explanation will mainly take the device update information of device A as ciphertext information as an example.
- next step may be to perform a first-time networking process (steps S603a-S607a in Figure 6), or to perform a non-first-time networking process (steps S603b-S606b in Figure 6).
- Case 1 When device B does not store the device information version number of device A (that is, the second device information version number), the first networking process can be performed.
- the possible reasons why device B does not store the device information version number of device A are: 1. Device A and device B are not connected to the network; 2. Device A and device B are connected to the network, but device B is not connected to the network. After the network was shut down and restarted, the device information of device A was stored in device B. All have been deleted.
- Case 2 When the BLE broadcast includes the device information version number of device A (i.e., the first device information version number), device B stores the device information version number of device A (i.e., the second device information version number), and the BLE broadcast If the device information version number of device A is inconsistent with the device information version number of device A stored in device B, you can perform the first networking process.
- the device information version number of device A i.e., the first device information version number
- device B stores the device information version number of device A (i.e., the second device information version number)
- the BLE broadcast If the device information version number of device A is inconsistent with the device information version number of device A stored in device B, you can perform the first networking process.
- the BLE broadcast includes the device information version number of device A
- the device information version number of device A is stored in device B
- the BLE broadcast includes the device information version number of device A and the device information version number of device A stored in device B.
- the non-first-time networking process is executed, that is, steps S603b to S606b in Figure 6 are executed.
- Device B establishes a BLE connection with device A.
- device B initiates a BLE connection request to device A to request the establishment of a BLE connection between device B and device A.
- device B initiates a BLE connection request to device A to request the establishment of a BLE connection between device B and device A.
- the detailed process of establishing a BLE connection between device B and device A can be found in the description of the BLE GATT protocol, which will not be described again here.
- Device A/B performs authentication and derives a communication key.
- device A and device B can interact to complete the confirmation or authentication of the identities of both parties, and in the process, create the communication key between the devices.
- the communication key may be a symmetric key, etc., which is not limited here.
- step S604a is an optional step. That is to say, in the above situation 2, you can speed up the online process by establishing a BLE connection without performing authentication.
- S605a Communicate using the communication key to exchange detailed information of the device.
- device A and device B can generate their own device information version numbers respectively. It can be understood that the device information version number of device A is used to indicate the current version of device information of device A, and the device information version number of device B is used to indicate the current version of device information of device B.
- device A and device B when they generate their own device information version numbers respectively, they can also generate their own broadcast keys. It can be understood that the broadcast key of device A is related to or matched with the device information version number of device A, and the broadcast key of device B is related or matched with the device information version number of device B. That is to say, when the device information version number of a certain device changes, the broadcast key of the device will also change.
- the device information version number can be produced randomly or incrementally, as long as it is not repeated, and because it needs to be carried in the broadcast, its length can be set to 2 bytes to reduce the impact on the broadcast. overhead.
- Reason 1 The device information this time has changed too much compared to the device information of device A during the first broadcast, and the data size of the difference has exceeded The scope of broadcast portability
- Reason 2 The key information in the device information has changed this time, such as the device name, and carrying this key information through broadcast will cause privacy risks
- Reason 3 The trust relationship between devices has changed Changes, such as device account changes.
- device A can use the communication key to send device A's detailed information to device B.
- the detailed information of device A can include the device information version number of device A, or the detailed information of device A can include the device A's device information version number and device A broadcast key.
- device B can also use the communication key to send device B's detailed information to device A.
- the detailed information of device B can include the device information version number of device B, or the detailed information of device B can include the device B's device information version number and device B's broadcast key and other information.
- the detailed information of the device can also include the communication key between devices, MAC address information, IP address information, complete device ID of the device, complete account information, device version number, Bluetooth version number, device name, etc. , there is no restriction here.
- Device A stores all received information related to device B
- device B stores all received information related to device A.
- device A can persist all the information received related to device B in the local file system (ie, local disk) of device A or in the cloud, and device B can store all the received information related to device A.
- the information is persisted in the local file system of device B or in the cloud, etc., and is not limited here.
- device A can also store all received information related to device B only in the memory
- device B can also store only all received information related to device A in the memory. It is understandable that when stored in the memory, the information saved by the device will be initialized or cleared or deleted after the device is shut down and restarted.
- device A will collect all information related to device B, such as the device information version number of device B, the broadcast key of device B, and the broadcast key of device A.
- the communication key between device B and device B is saved.
- device B will also save all the information related to device A, such as the device information version number of device A, the broadcast key of device A, the difference between device A and device B.
- the communication key between the two is saved. Even if the subsequent device goes offline, the device information of the peer device saved in this device will not be deleted. However, when the trust relationship between devices is released, the saved device information of the peer device can be deleted.
- Non-first-time networking process
- Device B restores the device information of device A stored in device B, and updates the device information of device A stored in device B based on the restored device information of device A and the device update information of device A in the BLE broadcast.
- device B can restore the device information of device A stored in device B.
- the device information of device A stored in device B may be the device information of device A obtained after the first networking.
- “restoration” in the embodiment of the present application can be understood as re-reading or reloading the device information of device A stored in device B.
- device B can update the device information of device A stored in device B based on the restored device information of device A and the device update information of device A in the BLE broadcast. Specifically, the detailed process is described as follows:
- device B can extract the broadcast key of device A from the device information of device A stored in device B, and decrypt the ciphertext information based on the broadcast key to obtain the information update of device A. Part of the plain text information, and the plain text information of the check value corresponding to the updated part. Then, integrity check is performed on the information update part of device A based on the check value.
- device B can calculate the information update part of device A according to a preset or preconfigured operation method to obtain a short value, and compare whether the calculated short value is the same as the check value. If the calculated short value is the same as the check value, it is determined that the content of the information update part of device A is complete. Therefore, subsequent steps can be generated based on the device information of device A stored in device B and combined with the information update part of device A. The latest device information of device A, and the generated latest device information of device A is saved. On the contrary, if the calculated abbreviation value is different from the check value, the first networking process of the above-mentioned steps S603a to S605a is performed.
- the device information of device A saved by device B may include the communication key between device A and device B, the MAC address information of device A, the IP address information of device A, the complete device ID of device A, and the complete device ID of device A.
- Account information, version number of device A, Bluetooth version number of device A, device name of device A, device information version number of device A, device information version number of device A, broadcast key of device A, etc., or Multiple items are not limited here.
- the device information of device B saved by device A may include the communication key between device A and device B, the MAC address information of device B, the IP address information of device B, the complete device ID of device B, the Complete account information, version number of device B, Bluetooth version number of device B, device name of device B, device information version number of device B, device information version number of device B, broadcast key of device B, etc. or multiple items, no restrictions are imposed here.
- device B can also determine whether to restore communication between device B and device A based on the information carried in the BLE broadcast.
- device B restoring communication between device B and device A can be understood as device B using device B.
- Use the communication key between device A and device A to communicate with device A that is, device B uses the communication key between device A and device B stored in device B to send communication data to device A.
- the device information version number of device A included in the BLE broadcast is the same as the device information version number of device A stored in device B
- the BLE broadcast may also include a communication key short value set or a communication key short value list, where the communication key short value set or communication key short value list includes one or more communication keys.
- Key short value For example, the plurality of short communication key values may include the short value of the communication key between device A and device B. Therefore, after receiving the BLE broadcast, device B can calculate the broadcast key of device A stored in device B according to a preset or preconfigured calculation method to obtain a short value, and compare the broadcast key of device A carried in the BLE broadcast with Whether the short value of the communication key between device B is the same as the calculated short value of the communication key between device A and device B. If they are the same, the communication between device B and device A can be restored.
- the BLE broadcast carries the short values of the communication keys between multiple devices and device A, then device B needs to traverse all the short values for matching verification.
- the multiple communication keys carried in the BLE broadcast When any short value of the key is the same as the calculated short value of the communication key between device A and device B, the communication between device B and device A can be restored. If there is no short value in the BLE broadcast, If the calculated short value of the communication key between device A and device B is the same, it means that it is not recoverable. It is understandable that if the communication between the devices cannot be restored, the first networking process of the above-mentioned steps S603a to S605a can be re-executed.
- FIG. 7 is a schematic diagram of inter-device communication recovery provided by an embodiment of the present application. As shown in Figure 7:
- the communication key (Kab) between device A and device B will be saved between device A and device B.
- A will save B's broadcast key (b), and B will save A's broadcast key.
- device B uses the broadcast key (a) of device A to decrypt the broadcast content and checks whether the broadcast carries the short value of the communication key (Kab). If so, it is considered that device A and device B The communication key (Kab) between them can be restored, that is, the communication between device A and device B can be restored, otherwise it is considered unrecoverable.
- device C uses device A's broadcast key (a) to decrypt the broadcast content and checks whether the broadcast carries the short value of the communication key (Kac). If so, it is considered that device A is connected to the BLE broadcast. The communication key (Kac) between device C can be restored, that is, the communication between device A and device C can be restored, otherwise it is considered unrecoverable.
- the length of the short value of the communication key involved in the embodiment of the present application may be 3 bytes to reduce broadcast overhead.
- TLV is a variable format
- T represents type (Type)
- L represents length (Length)
- V represents specific value (Value).
- device A contains the communication keys of device B and device C.
- T 1, it indicates that the type is communication key short value
- L is 6, which indicates that the length of communication key short value is 6 words in total.
- Section that is, the short value of the communication key of device B and device C is 3 bytes respectively, so there are 6 bytes in total
- V is the short value of the communication key of device B and the short value of the communication key of device C.
- the calculation method of the short value corresponding to the information update part of the computing device A and the calculation method of the short value corresponding to the broadcast key of device A stored in the computing device B may be the same or different, which is not the case here.
- the preset or preconfigured short value calculation method in the embodiment of the present application can be a hash algorithm.
- the hash algorithm can include MD series hash algorithm, SHA hash algorithm, SM3 hash algorithm, etc., which are not mentioned here.
- MD series hash algorithms can include MD2, MD4 and MD5, etc.
- SHA hash algorithms can include SHA-1, SHA-224, SHA-256, SHA-384, SHA-512, etc. There are no restrictions here. .
- Device B sends a BLE broadcast.
- device B After device B recovers the device information of device A based on the device update information of device A carried in the BLE broadcast sent by device A, device B can reply to the BLE broadcast to the peripheral device through the BLE broadcast mechanism.
- the peripheral device is device A as an example for schematic explanation. Accordingly, device A receives the BLE broadcast from device B.
- the BLE broadcast replied by device B may include device B's information and device B's device update information.
- device B's information e.g., device B's device update information.
- description of the BLE broadcast sent by device B, and the BLE broadcast received by device A from device B, and the processing of the BLE broadcast please refer to the above-mentioned description of the BLE broadcast sent by device A, and the BLE broadcast received by device B from device B.
- A's BLE broadcast and the description of the BLE broadcast processing process will not be described again here.
- the embodiment of this application needs to complete the generation and exchange of the device information version number and broadcast key, as well as the generation and exchange of device information, communication key, device information version number and broadcast key. storage.
- the non-first-time networking scenario can be understood as the device has been successfully networked before, but the network was disconnected because the device was shut down or the distance between the devices was too far. Subsequently, the device needs to be networked again because the device is restarted or the device is close again. scene.
- this device stores device information of other devices, device information version numbers of other devices, broadcast keys of other devices, and communication keys between other devices and this device, as well as stored The device information of this device, the device information version number of this device, and the broadcast key of this device. Therefore, in a non-first-time networking scenario, the device information version number and differential part in the BLE broadcast are extracted, and then combined The device information obtained last time can be quickly networked without having to establish a BLE connection and perform authentication, a time-consuming and resource-consuming process, thus accelerating the networking process.
- FIG. 8 is another schematic flowchart of the BLE-based communication method provided by an embodiment of the present application.
- the communication method includes the following steps S801 and S803.
- the method execution subject shown in Figure 8 may be the first device or a chip in the first device.
- FIG. 8 takes the first device as the execution subject of the method as an example for illustration. in:
- the first device receives the BLE broadcast from the second device.
- the second device sends a BLE broadcast, and accordingly, the first device receives the BLE broadcast from the second device.
- the BLE broadcast includes a first field, the first field is used to carry the first device information version number of the second device, and the first device information version number is used to indicate the version of the current device information of the second device.
- the device information version number in this application can also be understood as a device information identifier or device information index, and the device information identifier or device information index is used to mark device information.
- the first device information identifier or the first device information index included in the BLE broadcast sent by the second device is used to mark the current device information of the second device.
- the second device in FIG. 8 is equivalent to electronic device A in FIG. 6 (device A for short), and the first device is equivalent to electronic device B (device B for short).
- the first device and the second device can each set their own broadcast message filtering rules to avoid being woken up and notified by BLE broadcasts that are not of concern.
- the first device determines that the device information of the second device is stored in the first device.
- the first device determines whether the device information of the second device is stored in the first device.
- the first device determines that the device information of the second device is not stored in the first device, the first device performs the first networking process.
- the first device determines that the device information of the second device is stored in the first device
- the first device reads the second device information version number of the second device included in the stored device information of the second device, wherein the second The device information version number is used to indicate a version of the device information of the second device stored in the first device.
- the first device compares whether the first device information version number and the second device information version number are the same.
- the first device restores the device information of the second device stored in the first device.
- the first device can also update the device information of the second device stored in device B based on the restored device information of the second device and the device update information of the second device in the BLE broadcast. That is to say, when the first device information version number is the same as the second device information version number, the non-first-time networking process can be executed.
- S803 please refer to the relevant description of the non-first-time networking process in Figure 6. I won’t go into details here.
- a BLE establishment request is sent to the second device to establish a BLE connection between the second device and the first device.
- the first device may further receive the device information of the second device from the second device through the BLE connection, and store the device information of the second device from the second device. That is to say, when the first device information version number and the second device information version number are different, the first networking process can be executed.
- S803 please refer to the relevant description of the first networking process in Figure 6. This will not be described again.
- the communication device provided by the present application will be described in detail below with reference to FIGS. 9 and 10 .
- FIG. 9 is a schematic structural diagram of a communication device provided by an embodiment of the present application.
- the communication device 900 shown in Figure 9 can be used to perform part or all of the functions of the terminal device (such as device A or device B) in the method embodiment described in Figure 6 and/or Figure 8.
- the device may be a terminal device, a device in the terminal device, or a device that can be used in conjunction with the terminal device.
- the communication device 900 may also be a chip system.
- the communication device shown in FIG. 9 may include a Bluetooth module 901, a processing module 902 and a storage module 903. Among them, the processing module 902 is used for data processing.
- the Bluetooth module 901 is used to receive or send data.
- the storage module 903 is used to store data. in:
- Bluetooth module 901 is configured to receive a low-power Bluetooth BLE broadcast from a second device.
- the BLE broadcast includes a first field, and the first field is used to carry the first device information version number of the second device, so The first device information version number is used to indicate the version of the current device information of the second device;
- the processing module 902 is configured to determine that the storage module 903 of the first device stores the device information of the second device, and the device information of the second device includes the second device information version number of the second device, The second device information version number is used to indicate the version of the device information of the second device stored in the storage module 903;
- the processing module 902 restores the device information of the second device stored in the storage module 903 .
- the processing module 902 is further configured to: if the first device information version number and the second device information version number are not the same, send a request to the second device information version number through the Bluetooth module 901. The device sends a BLE establishment request to establish a BLE connection between the second device and the first device;
- the Bluetooth module 901 is also configured to receive device information of the second device from the second device through the BLE connection;
- the storage module 903 is configured to store the device information of the second device from the second device.
- the BLE broadcast further includes a second field, the second field is used to carry device update information of the second device;
- the processing module 902 is also used to:
- the device update information of the second device includes an information update part and a check value corresponding to the information update part;
- the processing module 902 is used to:
- the device information of the second device is updated and stored according to the information update part and the device information of the second device stored in the second device.
- the BLE broadcast also includes a broadcast encrypted salt value
- the device update information of the second device is based on the broadcast key of the second device, the information update part and the The ciphertext information encrypted by the check value corresponding to the information update part;
- the processing module 902 Before performing integrity verification on the information update part according to the verification value, the processing module 902 is used to:
- the ciphertext information is decrypted according to the salt value of the broadcast encryption and the broadcast key of the second device to obtain the information update part and a check value corresponding to the information update part.
- the BLE broadcast also includes a communication key short value list;
- the device information of the second device stored in the storage module 903 includes the second device and the first device. communication key;
- the processing module 902 is also used to:
- the first device determines a communication key short value corresponding to the communication key between the second device and the first device
- the Bluetooth module 901 uses the communication between the second device and the first device stored in the storage module 903 The key sends communication data to the second device.
- the device information of the second device stored in the storage module 903 includes a communication key between the second device and the first device;
- the Bluetooth module 901 is also used for:
- Communication data is sent to the second device using the communication key stored in the storage module 903 between the second device and the first device.
- the BLE broadcast also includes a short value of the account information of the second device and/or a short value of the device identification of the second device;
- the processing module 902 is also used to:
- the first device determines that there is a trust relationship between the second device and the first device, it is determined that the device information of the second device is stored in the first device.
- the Bluetooth module 901 is also used to:
- Send a BLE broadcast which is used by the second device to restore and update the device information of the first device stored in the second device.
- the Bluetooth module 901 is configured to send a low-power Bluetooth BLE broadcast to the first device.
- the BLE broadcast includes a first field, and the first field is used to carry the first device information version number of the second device.
- the first device information version number is used to indicate the version of the current device information of the second device.
- the Bluetooth module 901 is also used to:
- the BLE broadcast further includes a second field, and the second field is used to carry device update information of the second device.
- the device update information of the second device includes an information update part and a check value corresponding to the information update part.
- the BLE broadcast also includes a broadcast encrypted salt value
- the device update information of the second device is based on the broadcast key of the second device, the information update part and the The ciphertext information encrypted by the check value corresponding to the information update part.
- the Bluetooth module 901 is also used to:
- the Bluetooth module 901 is also used to:
- the device also includes a processing module 902:
- the processing module 902 is configured to restore and update the device information of the first device stored in the storage module 903 of the second device according to the BLE broadcast.
- FIG. 10 is a schematic structural diagram of another communication device provided by an embodiment of the present application.
- the communication device 1000 can be the terminal device described in the embodiment of the present application, and is used to implement the functions of the terminal device in Figure 6 and/or Figure 8.
- FIG. 10 shows only the main components of the terminal device.
- the communication device 1000 includes a processor 1001 , a memory 1002 and Bluetooth 1003 .
- the processor 1001 is mainly used to process communication protocols and communication data, control the entire communication device 1000, execute software programs, and process data of the software programs.
- Memory 1002 is mainly used to store software programs and data.
- Bluetooth 1003 is mainly used to receive or send data through the Bluetooth air interface.
- the processor 1001 can read the software program in the memory 1002, interpret and execute the instructions of the software program, and process the data of the software program.
- the processor processes the data to be sent and then sends the data via Bluetooth.
- the processor 1001 receives the signal through Bluetooth 1003 and converts the received signal into data to process the data.
- FIG. 10 only shows one memory and one processor.
- communication device 1000 may include multiple processors and memories.
- the memory may also be called a storage medium or a storage device, which is not limited in the embodiments of the present application.
- the processor may include a baseband processor and a central processor.
- the baseband processor is mainly used to process communication protocols and communication data.
- the central processor is mainly used to control the entire communication device 1000. Execute software programs and process data from software programs.
- the processor in Figure 10 integrates the functions of a baseband processor and a central processor. Those skilled in the art can understand that the baseband processor and the central processor can also be independent processors and are interconnected through technologies such as buses.
- the communication device 1000 may include multiple baseband processors to adapt to different network standards, the communication device 1000 may include multiple central processors to enhance its processing capabilities, and various components of the communication device 1000 may be connected through various buses.
- the baseband processor can also be expressed as a baseband processing circuit or a baseband processing chip.
- the central processing unit can also be expressed as a central processing circuit or a central processing chip.
- the function of processing communication protocols and communication data can be built into the processor, or can be stored in the storage unit in the form of a software program, and the processor executes the software program to implement the baseband processing function.
- the memory may include read-only memory and random access memory, and provide instructions and data to the processor.
- Part of the memory may also include non-volatile random access memory, etc., which is not limited here.
- Embodiments of the present application also provide a computer-readable storage medium. Instructions are stored in the computer-readable storage medium. When the instruction is run on a processor, the method flow of the above method embodiment is implemented.
- An embodiment of the present application also provides a computer program product.
- the computer program product is run on a processor, the method flow of the above method embodiment is implemented.
- the disclosed systems, devices and methods can be implemented in other ways.
- the device embodiments described above are only illustrative.
- the division of the units is only a logical functional division.
- the units described as separate components may or may not be physically separated.
- the components shown may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
- the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium.
- the technical solution of the present application is essentially or the part that contributes to the existing technology or the part of the technical solution can be embodied in the form of a software product.
- the computer software product is stored in a storage medium, including several instructions It is used to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of this application.
- the aforementioned computer-readable storage medium can be any available medium that can be accessed by a computer.
- computer-readable media may include random access memory (RAM), read-only memory (ROM), programmable ROM (PROM), Erasable programmable read-only memory (erasable PROM, EPROM), electrically erasable programmable read only memory (EEPROM), compact disc read-only memory (CD- ROM), universal serial bus flash disk, portable hard disk, or other optical disk storage, magnetic disk storage media, or other magnetic storage devices, or can be used to carry or store desired data in the form of instructions or data structures. program code and any other medium that can be accessed by a computer.
- RAM random access memory
- ROM read-only memory
- PROM programmable ROM
- EPROM Erasable programmable read-only memory
- EEPROM electrically erasable programmable read only memory
- CD- ROM compact disc read-only memory
- universal serial bus flash disk portable hard disk, or other optical disk storage, magnetic disk storage media, or other magnetic storage devices, or can be used to carry or store desired data in the form of instructions or data structures.
- RAM static random access memory
- DRAM dynamic random access memory
- synchronous RAM synchronous dynamic random access memory
- DRAM static random access memory
- SDRAM double data rate synchronous dynamic random access memory
- ESDRAM enhanced synchronous dynamic random access memory
- SCRAM synchronous link dynamic random access memory
- direct rambus RAM direct rambus RAM, DR RAM
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Databases & Information Systems (AREA)
- Multimedia (AREA)
- Mobile Radio Communication Systems (AREA)
Abstract
本申请提供了一种通信方法及相关装置,该方法包括:第一设备接收来自第二设备的低功耗蓝牙BLE广播,BLE广播包括第一字段,第一字段用于承载第二设备的第一设备信息版本号,第一设备信息版本号用于指示第二设备的当前设备信息的版本;第一设备确定第一设备中存储有第二设备的设备信息,第二设备的设备信息包括第二设备的第二设备信息版本号,第二设备信息版本号用于指示第一设备中存储的第二设备的设备信息的版本;若第一设备信息版本号与第二设备信息版本号相同,则恢复第一设备中存储的第二设备的设备信息。采用本申请提供的方法,可实现组网设备的快速上线。
Description
本申请要求于2022年08月19日提交中国专利局、申请号为202210999884.0、申请名称为“通信方法及相关装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
本申请涉及蓝牙技术领域,特别涉及一种通信方法及相关装置。
随着个人终端设备越来越越多,包括手机、平板电脑、手表、手环、个人计算机(personal computer,PC)等各种形态,设备之间的联动和协同的场景也越来越多,也带来了更多的便利性。设备之间互联的先决条件是感知到周边设备,并能和周边设备进行通信。通常而言,设备之间主要可以采用无线方式进行连接,包括无线保真(wireless fidelity,Wi-Fi)、蓝牙等常见方式。在室外场景下,由于缺少Wi-Fi环境,因此设备间的业务主要通过蓝牙方式实现设备之间的感知和通信。一般而言,某个设备在搜索周边设备时,通常需要发送组网广播,然后周边设备根据接收到的组网广播与该设备建立低功耗蓝牙(bluetooth low energy,BLE)连接,进一步地,设备双方会对设备身份进行认证,并协商出通信密钥,进而在产生的通信密钥上交换设备信息,以实现设备间组网。但是BLE连接、认证和设备信息的交换过程耗时较长且会占用较多蓝牙资源。基于此,如何实现组网设备的快速上线成为当前亟待解决的问题之一。
发明内容
本申请提供了一种通信方法及相关装置,可实现设备间的快速组网。
第一方面,本申请提供了一种通信方法,该方法包括:
第一设备接收来自第二设备的低功耗蓝牙BLE广播,所述BLE广播包括第一字段,所述第一字段用于承载所述第二设备的第一设备信息版本号,所述第一设备信息版本号用于指示所述第二设备的当前设备信息的版本;
所述第一设备确定所述第一设备中存储有所述第二设备的设备信息,所述第二设备的设备信息包括所述第二设备的第二设备信息版本号,所述第二设备信息版本号用于指示所述第一设备中存储的所述第二设备的设备信息的版本;
若所述第一设备信息版本号与所述第二设备信息版本号相同,则所述第一设备恢复所述第一设备中存储的所述第二设备的设备信息。
在本申请中,通过设计新的BLE广播的格式,即在BLE广播中携带第二设备的第一设备信息版本号,该第二设备的第一设备信息版本号可用于确定是否恢复第一设备中存储的第二设备的设备信息,具体地,当第一设备信息版本号与第一设备中存储的第二设备的设备信息中包括的第二设备信息版本号相同时,第一设备恢复第一设备中存储的第二设备的设备信息,这样有利于加快组网流程。可选的,本申请中的设备信息版本号也可以理解为是一种设备信息标识或设备信息索引,该设备信息标识或设备信息索引用于标记设备信息。例如第二设备发送的BLE广播中包括的第一设备信息标识或第一设备信息索引用于标记该第二设备的当前设备信息,第一设备中存储的第二设备的设备信息中所包括的第二设备信息标识或第二设备信息索引用于标记第一设备中存储的第二设备的设备信息。
在一种可能的实现中,所述方法还包括:
若所述第一设备信息版本号和所述第二设备信息版本号不相同,则所述第一设备向所述第二设备发送BLE建立请求,以建立所述第二设备和所述第一设备之间的BLE连接;
所述第一设备通过所述BLE连接接收来自所述第二设备的所述第二设备的设备信息;
所述第一设备存储所述来自所述第二设备的所述第二设备的设备信息。
在该种实现方式下,当所述第一设备信息版本号和所述第二设备信息版本号不相同时,通过建立BLE连接交互设备的设备信息,同样可实现设备间的组网。
在一种可能的实现中,所述BLE广播还包括第二字段,所述第二字段用于承载所述第二设备的设备更新信息;
所述方法还包括:
所述第一设备根据恢复的所述第二设备的设备信息和所述第二设备的设备更新信息,更新所述第二设
备的设备信息。
在该种实现方式下,BLE广播中还可以包括第二设备的设备更新信息,因此,第一设备可以根据恢复的第二设备的设备信息,再结合第二设备的设备更新信息更新第二设备的设备信息,而相比于通过建立BLE连接来交互设备的设备信息的流程,可加快组网速度。
在一种可能的实现中,所述第二设备的设备更新信息包括信息更新部分和所述信息更新部分对应的校验值;
所述第一设备根据恢复出的所述第二设备的设备信息和所述第二设备的设备更新信息,更新所述第二设备的设备信息,包括:
所述第一设备根据所述校验值对所述信息更新部分进行完整性校验;
若所述完整性校验的校验结果为校验通过,则所述第一设备根据所述信息更新部分和所述第二设备中存储的第二设备的设备信息更新并存储所述第二设备的设备信息。
在该种实现方式下,通过在BLE广播中携带信息更新部分和信息更新部分对应的校验值,进而可以根据校验值对信息更新部分进行完整性校验,可避免BLE广播在广播过程中发生丢包,有利于提高BLE广播中携带信息更新部分内容的可靠性。
在一种可能的实现中,所述BLE广播中还包括广播加密的盐值,所述第二设备的设备更新信息为基于所述第二设备的广播密钥对所述信息更新部分和所述信息更新部分对应的校验值进行加密的密文信息;
所述第一设备根据所述校验值对所述信息更新部分进行完整性校验之前,所述方法还包括:
所述第一设备根据所述广播加密的盐值和所述第二设备的广播密钥对所述密文信息进行解密,得到所述信息更新部分和所述信息更新部分对应的校验值。
在该种实现方式下,通过对BLE广播中携带的内容进行加密,可增强广播的安全性,防止攻击者的攻击。
在一种可能的实现中,所述BLE广播中还包括通信密钥简短值列表;所述第一设备中存储的所述第二设备的设备信息包括所述第二设备与所述第一设备之间的通信密钥;
所述方法还包括:
所述第一设备确定所述第二设备与所述第一设备之间的通信密钥对应的通信密钥简短值;
若所述通信密钥简短值列表中包括所述通信密钥简短值,则所述第一设备采用所述第一设备中存储的所述第二设备与所述第一设备之间的通信密钥向所述第二设备发送通信数据。
在该种实现方式下,通信密钥简短值列表也可以通过BLE广播携带,其中,通信密钥简短值列表中包括多个通信密钥对应的简短值。其中,当第一设备收到BLE广播后,可以将第一设备中存储的第二设备与第一设备之间的通信密钥按相同的运算方法进行计算得到一个简短值,并遍历BLE广播中还包括通信密钥简短值列表中是否包含该计算得到的一个简短值。具体地,当计算得到一个简短值包含于通信密钥简短值列表时,第一设备可以恢复第一设备和第二设备之间的通信(即第一设备可以采用第一设备中存储的第二设备与第一设备之间的通信密钥向第二设备发送通信数据),在提升安全性的同时,还可以一定程度提高通信效率。
在一种可能的实现中,所述第一设备中存储的所述第二设备的设备信息包括所述第二设备与所述第一设备之间的通信密钥;
所述方法还包括:
所述第一设备采用所述第一设备中存储的所述第二设备与所述第一设备之间的通信密钥向所述第二设备发送通信数据。
在该种实现方式下,当确定第一设备信息版本号与第二设备信息版本号相同时,第一设备立即恢复第一设备和第二设备之间的通信(即第一设备采用第一设备中存储的第二设备与第一设备之间的通信密钥向第二设备发送通信数据),可提高通信效率。
在一种可能的实现中,所述BLE广播中还包括所述第二设备的账号信息的简短值和/或所述第二设备的设备标识的简短值;
所述第一设备确定所述第一设备中存储有所述第二设备的设备信息之前,所述方法还包括:
所述第一设备根据所述第二设备的账号信息的简短值和/或所述第二设备的设备标识的简短值确定所述第二设备与所述第一设备之间是否具有信任关系;
在所述第一设备确定所述第二设备与所述第一设备之间具有信任关系时,所述第一设备确定所述第一设备中存储有所述第二设备的设备信息。
在该种实现方式下,当第一设备确定第二设备与第一设备之间具有信任关系时,再确定第一设备中存储有第二设备的设备信息,可避免被非关心的BLE广播唤醒和通知。
在一种可能的实现中,所述方法还包括:
所述第一设备发送BLE广播,所述第一设备发送的所述BLE广播用于所述第二设备恢复并更新所述第二设备中存储的所述第一设备的设备信息。
在该种实现方式下,第一设备同样可采用发送BLE广播的方式帮助第二设备恢复并更新第二设备中存储的第一设备的设备信息,因此,有利于提高第一设备在第二设备中的上线速度。
第二方面,本申请提供了一种通信方法,该方法包括:
第二设备向第一设备发送低功耗蓝牙BLE广播,所述BLE广播包括第一字段,所述第一字段用于承载所述第二设备的第一设备信息版本号,所述第一设备信息版本号用于指示所述第二设备的当前设备信息的版本。
在一种可能的实现中,所述方法还包括:
接收来自所述第一设备的BLE建立请求,以建立所述第二设备和所述第一设备之间的BLE连接;
所述第二设备通过所述BLE连接向所述第一设备发送所述第二设备的设备信息。
在一种可能的实现中,所述BLE广播还包括第二字段,所述第二字段用于承载所述第二设备的设备更新信息。
在一种可能的实现中,所述第二设备的设备更新信息包括信息更新部分和所述信息更新部分对应的校验值。
在一种可能的实现中,所述BLE广播中还包括广播加密的盐值,所述第二设备的设备更新信息为基于所述第二设备的广播密钥对所述信息更新部分和所述信息更新部分对应的校验值进行加密的密文信息。
在一种可能的实现中,所述方法还包括:
所述第二设备接收来自所述第一设备的通信数据。
在一种可能的实现中,所述方法还包括:
所述第二设备接收来自所述第一设备的BLE广播,所述第二设备基于所述第一设备发送的所述BLE广播恢复并更新所述第二设备中存储的所述第一设备的设备信息。
第三方面,本申请提供了一种通信装置,该通信装置为第一设备,该装置包括:
蓝牙模块,用于接收来自第二设备的低功耗蓝牙BLE广播,所述BLE广播包括第一字段,所述第一字段用于承载所述第二设备的第一设备信息版本号,所述第一设备信息版本号用于指示所述第二设备的当前设备信息的版本;
处理模块,用于确定所述第一设备的存储模块中存储有所述第二设备的设备信息,所述第二设备的设备信息包括所述第二设备的第二设备信息版本号,所述第二设备信息版本号用于指示所述存储模块中存储的所述第二设备的设备信息的版本;
若所述第一设备信息版本号与所述第二设备信息版本号相同,则所述处理模块恢复所述存储模块中存储的所述第二设备的设备信息。
在一种可能的实现中,所述处理模块,还用于若所述第一设备信息版本号和所述第二设备信息版本号不相同,则通过所述蓝牙模块向所述第二设备发送BLE建立请求,以建立所述第二设备和所述第一设备之间的BLE连接;
所述蓝牙模块,还用于通过所述BLE连接接收来自所述第二设备的所述第二设备的设备信息;
所述存储模块,用于存储所述来自所述第二设备的所述第二设备的设备信息。
在一种可能的实现中,所述BLE广播还包括第二字段,所述第二字段用于承载所述第二设备的设备更新信息;
所述处理模块还用于:
根据恢复的所述第二设备的设备信息和所述第二设备的设备更新信息,更新所述第二设备的设备信息。
在一种可能的实现中,所述第二设备的设备更新信息包括信息更新部分和所述信息更新部分对应的校验值;
所述根据恢复出的所述第二设备的设备信息和所述第二设备的设备更新信息,更新所述第二设备的设备信息时,所述处理模块用于:
根据所述校验值对所述信息更新部分进行完整性校验;
若所述完整性校验的校验结果为校验通过,则根据所述信息更新部分和所述第二设备中存储的第二设备的设备信息更新并存储所述第二设备的设备信息。
在一种可能的实现中,所述BLE广播中还包括广播加密的盐值,所述第二设备的设备更新信息为基于所述第二设备的广播密钥对所述信息更新部分和所述信息更新部分对应的校验值进行加密的密文信息;
所述根据所述校验值对所述信息更新部分进行完整性校验之前,所述处理模块用于:
根据所述广播加密的盐值和所述第二设备的广播密钥对所述密文信息进行解密,得到所述信息更新部分和所述信息更新部分对应的校验值。
在一种可能的实现中,所述BLE广播中还包括通信密钥简短值列表;所述存储模块中存储的所述第二设备的设备信息包括所述第二设备与所述第一设备之间的通信密钥;
所述处理模块还用于:
所述第一设备确定所述第二设备与所述第一设备之间的通信密钥对应的通信密钥简短值;
若所述通信密钥简短值列表中包括所述通信密钥简短值,则通过所述蓝牙模块采用所述存储模块中存储的所述第二设备与所述第一设备之间的通信密钥向所述第二设备发送通信数据。
在一种可能的实现中,所述存储模块中存储的所述第二设备的设备信息包括所述第二设备与所述第一设备之间的通信密钥;
所述蓝牙模块还用于:
采用所述存储模块中存储的所述第二设备与所述第一设备之间的通信密钥向所述第二设备发送通信数据。
在一种可能的实现中,所述BLE广播中还包括所述第二设备的账号信息的简短值和/或所述第二设备的设备标识的简短值;
所述确定所述第一设备中存储有所述第二设备的设备信息之前,所述处理模块还用于:
根据所述第二设备的账号信息的简短值和/或所述第二设备的设备标识的简短值确定所述第二设备与所述第一设备之间是否具有信任关系;
在所述第一设备确定所述第二设备与所述第一设备之间具有信任关系时,确定所述第一设备中存储有所述第二设备的设备信息。
在一种可能的实现中,所述蓝牙模块还用于:
发送BLE广播,所述BLE广播用于所述第二设备恢复并更新所述第二设备中存储的所述第一设备的设备信息。
第四方面,本申请提供了一种通信装置,该装置包括:
蓝牙模块,用于向第一设备发送低功耗蓝牙BLE广播,所述BLE广播包括第一字段,所述第一字段用于承载所述第二设备的第一设备信息版本号,所述第一设备信息版本号用于指示所述第二设备的当前设备信息的版本。
在一种可能的实现中,所述蓝牙模块还用于:
接收来自所述第一设备的BLE建立请求,以建立所述第二设备和所述第一设备之间的BLE连接;
通过所述BLE连接向所述第一设备发送所述第二设备的设备信息。
在一种可能的实现中,所述BLE广播还包括第二字段,所述第二字段用于承载所述第二设备的设备更新信息。
在一种可能的实现中,所述第二设备的设备更新信息包括信息更新部分和所述信息更新部分对应的校验值。
在一种可能的实现中,所述BLE广播中还包括广播加密的盐值,所述第二设备的设备更新信息为基于所述第二设备的广播密钥对所述信息更新部分和所述信息更新部分对应的校验值进行加密的密文信息。
在一种可能的实现中,所述蓝牙模块还用于:
接收来自所述第一设备的通信数据。
在一种可能的实现中,所述蓝牙模块还用于:
接收来自所述第一设备的BLE广播;
所述装置还包括处理模块:
所述处理模块,用于根据所述BLE广播恢复并更新所述第二设备的存储模块中存储的所述第一设备的
设备信息。
第五方面,本申请提供了一种电子设备,包括一个或多个处理器,一个或多个蓝牙模块和一个或多个存储器。该一个或多个存储器,一个或多个蓝牙模块与一个或多个处理器耦合,一个或多个存储器用于存储计算机程序代码,计算机程序代码包括计算机指令,当一个或多个处理器执行计算机指令时,使得电子设备执行上述任一方面任一项可能的实现方式中的通信方法。
第六方面,本申请实施例提供了一种计算机存储介质,包括计算机指令,当计算机指令在电子设备上运行时,使得电子设备执行上述任一方面任一项可能的实现方式中的通信方法。
第七方面,本申请实施例提供了一种计算机程序产品,当计算机程序产品在计算机上运行时,使得计算机执行上述任一方面任一项可能的实现方式中的通信方法。
图1是本申请提供的无线通信系统的示意图;
图2是本申请提供的分布式通信的架构示意图;
图3是设备间组网的流程示意图;
图4是本申请提供的一种电子设备的结构示意图;
图5为本申请实施例提供的另一种电子设备的结构示意图;
图6是本申请实施例提供的基于BLE的通信方法的一流程示意图;
图7是本申请实施例提供的一种设备间通信恢复的示意图;
图8是本申请实施例提供的基于BLE的通信方法的另一流程示意图;
图9是本申请实施例提供的一种通信装置的结构示意图;
图10是本申请实施例提供的另一种通信装置的结构示意图。
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行描述。
其中,在本申请实施例的描述中,除非另有说明,“/”表示或的意思,例如,A/B可以表示A或B;本文中的“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,在本申请实施例的描述中,“多个”是指两个或多于两个。
以下,术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括一个或者更多个该特征。在本申请实施例的描述中,除非另有说明,“多个”的含义是两个或两个以上。
本申请实施例提供了基于低功耗蓝牙的通信方法及相关装置,在非首次组网场景下,电子设备之间不必执行BLE连接建立、认证和信息交换等流程,而是通过BLE广播交换设备信息。实施本申请,可实现组网设备的快速上线。
首先介绍本申请实施例提供的无线通信系统。
请参见图1,图1是本申请提供的无线通信系统的示意图。如图1所示,该无线通信系统可包括多个电子设备。其中,各个电子设备可以基于BLE和无线通信系统中的其他电子设备通信。本申请实施例对电子设备的类型不做具体限定,例如电子设备可以为手机、平板电脑、个人数字助理(personal digital assistant,PDA)、可穿戴设备(例如蓝牙耳机)、膝上型计算机(laptop)等便携式电子设备,也可以为台式计算机等非便携式电子设备。电子设备的示例包括但不限于搭载iOS、android、microsoft或者其他操作系统的电子设备。
本申请实施例中的电子设备也可以称作终端设备,其可以是一种具有无线收发功能的设备,具体可以指用户设备(user equipment,UE)、接入终端、用户单元(subscriber unit)、用户站、移动台(mobile station)、客户终端设备(customer-premises equipment,CPE)、远方站、远程终端、移动设备、用户终端、无线通信设备、用户代理或用户装置。终端设备还可以是卫星电话、蜂窝电话、智能手机、无线数据卡、无线调制解调器、机器类型通信设备、可以是无绳电话、会话启动协议(session initiation protocol,SIP)电话、无线本地环路(wireless local loop,WLL)站、个人数字处理(personal digital assistant,PDA)、具有无线通信功能的手持设备、计算设备或连接到无线调制解调器的其它处理设备、车载设备、高空飞机上搭载的通
信设备、可穿戴设备、无人机、机器人、智能销售点(point of sale,POS)机、设备到设备通信(device-to-device,D2D)中的终端、车到一切(vehicle to everything,V2X)中的终端、虚拟现实(virtual reality,VR)终端设备、增强现实(augmented reality,AR)终端设备、工业控制(industrial control)中的无线终端、无人驾驶(self driving)中的无线终端、远程医疗(remote medical)中的无线终端、智能电网(smart grid)中的无线终端、运输安全(transportation safety)中的无线终端、智慧城市(smart city)中的无线终端、智慧家庭(smart home)中的无线终端或者未来通信网络中的终端设备等,本申请不作限制。
本申请实施例中,用于实现终端设备的功能的装置可以是终端设备;也可以是能够支持终端设备实现该功能的装置,例如芯片系统。该装置可以被安装在终端设备中或者和终端设备匹配使用。本申请实施例中,芯片系统可以由芯片构成,也可以包括芯片和其他分立器件。
下面介绍本申请实施例适用的系统架构。
请参见图2,图2是本申请提供的分布式通信的架构示意图。如图2所示,以无线通信系统中任意两个电子设备,例如电子设备A和电子设备B为例,分布式通信服务在蓝牙芯片、蓝牙驱动和蓝牙服务的基础之上,为其他分布式服务和其他App提供通信能力。其中:
蓝牙芯片:实现蓝牙协议和空口上的协议交互。
蓝牙驱动:按设备架构实现蓝牙驱动的功能,完成对蓝牙芯片的交互流程。
蓝牙服务:提供蓝牙基础通信能力。
分布式通信服务:在蓝牙服务的基础上,对上层的分布式其他服务以及App提供发现、连接、传输等通信能力。
可理解的,无线通信系统中各个电子设备通常需要先组网才能进行通信。具体地,某个电子设备在搜索周边电子设备时,通常需要发送组网广播,然后周边电子设备可以根据接收到的组网广播与该电子设备建立BLE连接,进一步地,电子设备双方会对电子设备身份进行认证,并协商出通信密钥,进而在产生的通信密钥上交换电子设备信息,以实现电子设备间组网。
请参见图3,图3是设备间组网的流程示意图。假设无线通信系统包括电子设备A(简称设备A),电子设备B(简称设备B)和电子设备C(简称设备C)。如图3所示,各电子设备在启动后会设置各自的广播报文过滤规则,只有当收到的BLE广播满足广播报文过滤规则时,才会被通知进行处理。也就是说,某个设备通过设置广播报文过滤规则,可以避免该设备被非关心的BLE广播唤醒并通知。
具体地,当某个电子设备(例如以设备A为例)需要搜索周边设备时,将发送组网广播。通常来说,组网广播可以通过BLE广播机制向周边设备广播发送,在本申请中,组网广播也可以描述为BLE广播。
其中BLE广播中包含有本设备(即设备A)的信息,例如本设备的账号信息,设备标识(Identity,ID),设备类型,以及组网广播类型等信息。其中,设备A发送的BLE广播中包括的账号信息通常为设备A的账号信息的简短值,BLE广播中包括的设备ID通常为设备A的设备ID的简短值。其中,组网广播类型包括是否唤醒灭屏设备,心跳类型,消息类型等,在此不做限制。
相应地,周边设备(如设备B和设备C)在收到BLE广播后,若确定该BLE广播满足其广播报文过滤规则,那么周边设备将根据BLE广播中设备A的信息,以及存储的本设备的信息,决策是否需要和设备A进行组网。为方便描述,以下主要以设备A与设备B之间的交互为例进行示意性说明。
通常来说,设备B可以根据接收到的设备A的信息以及本设备的信息,查看设备A是否已经在设备B中组网上线。如已经组网上线,则说明该设备A已经和设备B完成了组网。否则,检查设备B是否与设备A满足组网条件,如果设备B确定其与发送广播的设备A满足组网条件,例如设备A的账号信息的简短值和设备B的账号信息的简短值相同时,或者,设备A和设备B之间具有其他信任关系时,那么设备B会向设备A发起BLE连接请求,以请求建立BLE连接。
在成功建立设备B与设备A之间的BLE连接之后,在此BLE连接的基础上,设备A与设备B之间进行认证,并派生出通信密钥,以用于后续传输过程中对数据进行加密,即设备A和设备B后续可以使用通信密钥进行通信,即在加密的通道上,交换彼此设备的详细信息,例如交换彼此设备的完整设备ID,完整账号信息,设备的版本号、蓝牙的版本号,设备名称,设备的互联网协议(internet protocol,IP)地址信息,设备的媒体接入控制(medium access control,MAC)地址信息,设备的分布式通信能力信息,设备支持的传输协议,设备支持的软件版本信息,传输的缓冲区大小等信息中的一项或者多项,在此不做限制。完成信息交换后,设备间组网成功,设备A将在设备B中上线,设备B也会在设备A中上线。
可理解的,当设备A周边有多个设备(例如还包括设备C)时,多个设备均需要和发送广播的设备A进行交互,设备间的交互流程可参见上述设备A与设备B之间的交互过程,在此不再赘述。
需要说明的是,设备A持续发送BLE广播一段时间后,将会停止发送BLE广播。可理解的,若设备A持续发送BLE广播,则将持续消耗设备A的电量资源。
需要说明的是,设备间(例如设备A和设备B之间,或者设备A和设备C之间)远离后,再次靠近,或是设备关机后重新开机等场景,设备都需要重新执行上述流程后,包括执行BLE广播发送、BLE连接建立、认证、设备信息交换等流程后,才能重新组网上线。
需要说明的是,由于BLE连接建立、认证和设备信息交换过程耗时较长且会占用较多蓝牙资源,一般情况下可能需要2-5s的耗时,因此,降低了设备组网上线的效率。
基于此,本申请提供了一种基于低功耗蓝牙的通信方法及相关装置,可以提升设备组网上线的效率。
下面介绍本申请实施例中的电子设备的结构。
请参见图4,图4是本申请提供的一种电子设备的结构示意图。如图4所示,该电子设备可以包括如下模块:
发现模块:负责发送和接收广播。
连接模块:负责和指定的设备连接,以及接收连接。
传输模块:在连接通道的基础上,提供收发数据的能力。
设备信息存储模块:将设备信息存储在本地,包括对端设备和本机设备信息,内容包括设备的基本信息,和通信的密钥信息等。
在线设备管理:管理在周边的可信设备,需要满足可信和可通信两个条件。
设备信息恢复模块:基于广播信息和存储的设备信息,恢复通信密钥,实现快速上线。
设备信息同步:在安全通道上完成信息的交换,以及差异更新。
认证模块:负责对设备间进行认证,并协商或是派生出通信密钥,并管理设备间的通信密钥。
请参见图5,图5为本申请实施例提供的另一种电子设备的结构示意图。该电子设备100可以是图1所示的无线通信系统中的电子设备。
如图5所示,电子设备100可以包括处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194,以及用户标识模块(subscriber identification module,SIM)卡接口195等。其中传感器模块180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C,加速度传感器180E,距离传感器180F,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L等。
可以理解的是,本申请实施例示意的结构并不构成对电子设备100的具体限定。在本申请另一些实施例中,电子设备100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。
处理器110可以包括一个或多个处理模块,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,存储器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理模块可以是独立的器件,也可以集成在一个或多个处理器中。
其中,控制器可以是电子设备100的神经中枢和指挥中心。控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。
处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。在本申请实施例中,存储器存储了使得电子设备执行本申请实施例提供的基于BLE的通信方法的指令,关于本申请提供的基于BLE的通信方法可参照后续实施例的相关描述。在本申请的一些实施例中,存储器还可以存储用户预先设置的紧急求助信息。
在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路(inter-integrated circuit,I2C)接口,集成电路内置音频(inter-integrated circuit sound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口,移动产业处理器
接口(mobile industry processor interface,MIPI),通用输入输出(general-purpose input/output,GPIO)接口,用户标识模块(subscriber identity module,SIM)接口,和/或通用串行总线(universal serial bus,USB)接口等。
I2C接口是一种双向同步串行总线,包括一根串行数据线(serial data line,SDA)和一根串行时钟线(derail clock line,SCL)。在一些实施例中,处理器110可以包含多组I2C总线。处理器110可以通过不同的I2C总线接口分别耦合触摸传感器180K,充电器,闪光灯,摄像头193等。例如:处理器110可以通过I2C接口耦合触摸传感器180K,使处理器110与触摸传感器180K通过I2C总线接口通信,实现电子设备100的触摸功能。
I2S接口可以用于音频通信。在一些实施例中,处理器110可以包含多组I2S总线。处理器110可以通过I2S总线与音频模块170耦合,实现处理器110与音频模块170之间的通信。在一些实施例中,音频模块170可以通过I2S接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。
PCM接口也可以用于音频通信,将模拟信号抽样,量化和编码。在一些实施例中,音频模块170与无线通信模块160可以通过PCM总线接口耦合。在一些实施例中,音频模块170也可以通过PCM接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。所述I2S接口和所述PCM接口都可以用于音频通信。
UART接口是一种通用串行数据总线,用于异步通信。该总线可以为双向通信总线。它将要传输的数据在串行通信与并行通信之间转换。在一些实施例中,UART接口通常被用于连接处理器110与无线通信模块160。例如:处理器110通过UART接口与无线通信模块160中的蓝牙模块通信,实现蓝牙功能。在一些实施例中,音频模块170可以通过UART接口向无线通信模块160传递音频信号,实现通过蓝牙耳机播放音乐的功能。
MIPI接口可以被用于连接处理器110与显示屏194,摄像头193等外围器件。MIPI接口包括摄像头串行接口(camera serial interface,CSI),显示屏串行接口(display serial interface,DSI)等。在一些实施例中,处理器110和摄像头193通过CSI接口通信,实现电子设备100的拍摄功能。处理器110和显示屏194通过DSI接口通信,实现电子设备100的显示功能。
GPIO接口可以通过软件配置。GPIO接口可以被配置为控制信号,也可被配置为数据信号。在一些实施例中,GPIO接口可以用于连接处理器110与摄像头193,显示屏194,无线通信模块160,音频模块170,传感器模块180等。GPIO接口还可以被配置为I2C接口,I2S接口,UART接口,MIPI接口等。
USB接口130是符合USB标准规范的接口,具体可以是Mini USB接口,Micro USB接口,USB Type C接口等。USB接口130可以用于连接充电器为电子设备100充电,也可以用于电子设备100与外围设备之间传输数据。也可以用于连接耳机,通过耳机播放音频。该接口还可以用于连接其他电子设备,例如AR设备等。
可以理解的是,本申请实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对电子设备100的结构限定。在本申请另一些实施例中,电子设备100也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。
充电管理模块140用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。在一些有线充电的实施例中,充电管理模块140可以通过USB接口130接收有线充电器的充电输入。在一些无线充电的实施例中,充电管理模块140可以通过电子设备100的无线充电线圈接收无线充电输入。充电管理模块140为电池142充电的同时,还可以通过电源管理模块141为电子设备供电。
电源管理模块141用于连接电池142,充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110,内部存储器121,外部存储器,显示屏194,摄像头193,和无线通信模块160等供电。电源管理模块141还可以用于监测电池容量,电池循环次数,电池健康状态(漏电,阻抗)等参数。在其他一些实施例中,电源管理模块141也可以设置于处理器110中。在另一些实施例中,电源管理模块141和充电管理模块140也可以设置于同一个器件中。
电子设备100的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。
天线1和天线2用于发射和接收电磁波信号。电子设备100中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。
移动通信模块150可以提供应用在电子设备100上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理
器进行解调。移动通信模块150还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。在一些实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。
调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频设备(不限于扬声器170A,受话器170B等)输出声音信号,或通过显示屏194显示图像或视频。在一些实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器110,与移动通信模块150或其他功能模块设置在同一个器件中。
无线通信模块160可以提供应用在电子设备100上的包括无线局域网(wireless local area networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),全球导航卫星系统(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器110。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。在本申请实施例中,电子设备100支持BLE,可基于BLE和其他设备通信。电子设备100可以在BLE广播信道上发送或者扫描本申请实施例提供的BLE广播。
在一些实施例中,电子设备100的天线1和移动通信模块150耦合,天线2和无线通信模块160耦合,使得电子设备100可以通过无线通信技术与网络以及其他设备通信。所述无线通信技术可以包括全球移动通讯系统(global system for mobile communications,GSM),通用分组无线服务(general packet radio service,GPRS),码分多址接入(code division multiple access,CDMA),宽带码分多址(wideband code division multiple access,WCDMA),时分码分多址(time-division code division multiple access,TD-SCDMA),长期演进(long term evolution,LTE),BT,GNSS,WLAN,NFC,FM,和/或IR技术等。所述GNSS可以包括全球卫星定位系统(global positioning system,GPS),全球导航卫星系统(global navigation satellite system,GLONASS),北斗卫星导航系统(beidou navigation satellite system,BDS),准天顶卫星系统(quasi-zenith satellite system,QZSS)和/或星基增强系统(satellite based augmentation systems,SBAS)。在本申请的一些实施例中,电子设备100可以通过无线通信技术获取自身的位置信息。
电子设备100通过GPU,显示屏194,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。
显示屏194用于显示图像,视频等。显示屏194包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emitting diode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode的,AMOLED),柔性发光二极管(flex light-emitting diode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot light emitting diodes,QLED)等。在一些实施例中,电子设备100可以包括1个或N个显示屏194,N为大于1的正整数。
电子设备100可以通过ISP,摄像头193,视频编解码器,GPU,显示屏194以及应用处理器等实现拍摄功能。
ISP用于处理摄像头193反馈的数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将所述电信号传递给ISP处理,转化为肉眼可见的图像。ISP还可以对图像的噪点,亮度等进行算法优化。ISP还可以对拍摄场景的曝光,色温等参数优化。在一些实施例中,ISP可以设置在摄像头193中。
摄像头193用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。感光元件可以是电荷耦合器件(charge coupled device,CCD)或互补金属氧化物半导体(complementary metal-oxide-semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB,YUV等格式的图像信号。在一些实施例中,电子设备100可以包括1个或N个摄像头193,N为大于1的正整数。
数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。例如,当电子设备100在频点选择时,数字信号处理器用于对频点能量进行傅里叶变换等。
视频编解码器用于对数字视频压缩或解压缩。电子设备100可以支持一种或多种视频编解码器。这样,电子设备100可以播放或录制多种编码格式的视频,例如:动态图像专家组(moving picture experts group,MPEG)1,MPEG2,MPEG3,MPEG4等。
NPU为神经网络(neural-network,NN)计算处理器,通过借鉴生物神经网络结构,例如借鉴人脑神经元之间传递模式,对输入信息快速处理,还可以不断的自学习。通过NPU可以实现电子设备100的智能认知等应用,例如:图像识别,人脸识别,语音识别,文本理解等。
外部存储器接口120可以用于连接外部存储卡,例如Micro SD卡,实现扩展电子设备100的存储能力。外部存储卡通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将音乐,视频等文件保存在外部存储卡中。
内部存储器121可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。处理器110通过运行存储在内部存储器121的指令,从而执行电子设备100的各种功能应用以及数据处理。内部存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统,至少一个功能所需的应用程序(比如声音播放功能,图像播放功能等)等。存储数据区可存储电子设备100使用过程中所创建的数据(比如音频数据,电话本等)等。此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。
电子设备100可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。例如音乐播放,录音等。
音频模块170用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块170还可以用于对音频信号编码和解码。在一些实施例中,音频模块170可以设置于处理器110中,或将音频模块170的部分功能模块设置于处理器110中。
扬声器170A,也称“喇叭”,用于将音频电信号转换为声音信号。电子设备100可以通过扬声器170A收听音乐,或收听免提通话。
受话器170B,也称“听筒”,用于将音频电信号转换成声音信号。当电子设备100接听电话或语音信息时,可以通过将受话器170B靠近人耳接听语音。在本申请的一些实施例中,受话器可用于接收用户输入的用于发送求救广播包的语音。
麦克风170C,也称“话筒”,“传声器”,用于将声音信号转换为电信号。当拨打电话或发送语音信息时,用户可以通过人嘴靠近麦克风170C发声,将声音信号输入到麦克风170C。电子设备100可以设置至少一个麦克风170C。在另一些实施例中,电子设备100可以设置两个麦克风170C,除了采集声音信号,还可以实现降噪功能。在另一些实施例中,电子设备100还可以设置三个,四个或更多麦克风170C,实现采集声音信号,降噪,还可以识别声音来源,实现定向录音功能等。在本申请的一些实施例中,麦克风可用于接收用户输入的用于发送求救广播包的语音。
耳机接口170D用于连接有线耳机。耳机接口170D可以是USB接口130,也可以是3.5mm的开放移动电子设备平台(open mobile terminal platform,OMTP)标准接口,美国蜂窝电信工业协会(cellular telecommunications industry association of the USA,CTIA)标准接口。
压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器180A可以设置于显示屏194。压力传感器180A的种类很多,如电阻式压力传感器,电感式压力传感器,电容式压力传感器等。电容式压力传感器可以是包括至少两个具有导电材料的平行板。当有力作用于压力传感器180A,电极之间的电容改变。电子设备100根据电容的变化确定压力的强度。当有触摸操作作用于显示屏194,电子设备100根据压力传感器180A检测所述触摸操作强度。电子设备100也可以根据压力传感器180A的检测信号计算触摸的位置。在一些实施例中,作用于相同触摸位置,但不同触摸操作强度的触摸操作,可以对应不同的操作指令。例如:当有触摸操作强度小于第一压力阈值的触摸操作作用于短消息应用图标时,执行查看短消息的指令。当有触摸操作强度大于或等于第一压力阈值的触摸操作作用于短消息应用图标时,执行新建短消息的指令。在本申请的一些实施例中,压力传感器可用于检测用户输入的用于发送求救广播包的手势。
陀螺仪传感器180B可以用于确定电子设备100的运动姿态。在一些实施例中,可以通过陀螺仪传感器180B确定电子设备100围绕三个轴(即,x,y和z轴)的角速度。陀螺仪传感器180B可以用于拍摄防抖。示例性的,当按下快门,陀螺仪传感器180B检测电子设备100抖动的角度,根据角度计算出镜头模组需要补偿的距离,让镜头通过反向运动抵消电子设备100的抖动,实现防抖。陀螺仪传感器180B还可以用于导航,体感游戏场景。
气压传感器180C用于测量气压。在一些实施例中,电子设备100通过气压传感器180C测得的气压值计算海拔高度,辅助定位和导航。
加速度传感器180E可检测电子设备100在各个方向上(一般为三轴)加速度的大小。当电子设备100静止时可检测出重力的大小及方向。还可以用于识别电子设备姿态,应用于横竖屏切换,计步器等应用。
距离传感器180F,用于测量距离。电子设备100可以通过红外或激光测量距离。在一些实施例中,拍摄场景,电子设备100可以利用距离传感器180F测距以实现快速对焦。
环境光传感器180L用于感知环境光亮度。电子设备100可以根据感知的环境光亮度自适应调节显示屏194亮度。环境光传感器180L也可用于拍照时自动调节白平衡。环境光传感器180L还可以与接近光传感器(图中未示出)配合,检测电子设备100是否在口袋里,以防误触。
指纹传感器180H用于采集指纹。电子设备100可以利用采集的指纹特性实现指纹解锁,访问应用锁,指纹拍照,指纹接听来电等。
温度传感器180J用于检测温度。在一些实施例中,电子设备100利用温度传感器180J检测的温度,执行温度处理策略。例如,当温度传感器180J上报的温度超过阈值,电子设备100执行降低位于温度传感器180J附近的处理器的性能,以便降低功耗实施热保护。在另一些实施例中,当温度低于另一阈值时,电子设备100对电池142加热,以避免低温导致电子设备100异常关机。在其他一些实施例中,当温度低于又一阈值时,电子设备100对电池142的输出电压执行升压,以避免低温导致的异常关机。
触摸传感器180K,也称“触控面板”。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,也称“触控屏”。触摸传感器180K用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器180K也可以设置于电子设备100的表面,与显示屏194所处的位置不同。
按键190包括开机键,音量键等。按键190可以是机械按键。也可以是触摸式按键。电子设备100可以接收按键输入,产生与电子设备100的用户设置以及功能控制有关的键信号输入。
马达191可以产生振动提示。马达191可以用于来电振动提示,也可以用于触摸振动反馈。例如,作用于不同应用(例如拍照,音频播放等)的触摸操作,可以对应不同的振动反馈效果。作用于显示屏194不同区域的触摸操作,马达191也可对应不同的振动反馈效果。不同的应用场景(例如:时间提醒,接收信息,闹钟,游戏等)也可以对应不同的振动反馈效果。触摸振动反馈效果还可以支持自定义。
指示器192可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。
SIM卡接口195用于连接SIM卡。SIM卡可以通过插入SIM卡接口195,或从SIM卡接口195拔出,实现和电子设备100的接触和分离。电子设备100可以支持1个或N个SIM卡接口,N为大于1的正整数。SIM卡接口195可以支持Nano SIM卡,Micro SIM卡,SIM卡等。同一个SIM卡接口195可以同时插入多张卡。所述多张卡的类型可以相同,也可以不同。SIM卡接口195也可以兼容不同类型的SIM卡。SIM卡接口195也可以兼容外部存储卡。电子设备100通过SIM卡和网络交互,实现通话以及数据通信等功能。在一些实施例中,电子设备100采用eSIM,即:嵌入式SIM卡。eSIM卡可以嵌在电子设备100中,不能和电子设备100分离。
其中,上述电子设备100的软件系统可以采用分层架构,事件驱动架构,微核架构,微服务架构,或云架构等,在此不做限制。
需要说明的是,以下本申请中描述的设备信息版本号也可以理解为是一种设备信息标识或设备信息索引,该设备信息标识或设备信息索引用于标记设备信息。
通常来说,BLE广播中包括的设备信息标识或设备信息索引可用于标记该BLE广播的广播发送方的当前设备信息。而某个设备中存储的另一个设备的设备信息中所包括的设备信息标识或设备信息索引用于标记该设备中存储的另一个设备的设备信息。示例性地,设备信息版本号或设备信息标识或设备信息索引具体表现形式可以是数字,字符或字符串等,或者,也可以是由数字和字符组成的混合形式等,具体根据实际场景确定,在此不做限制。
为方便描述,以下本申请实施例主要以设备信息版本号为例进行示意性说明。
下面基于图1所示的无线通信系统以及图4或图5所示的电子设备,结合具体的应用场景对本申请实施例提供的基于BLE的通信方法进行说明。
请参见图6,图6是本申请实施例提供的基于BLE的通信方法的一流程示意图。其中图6中的电子设备A
(简称设备A)即相当于第二设备,电子设备B(简称设备B)即相当于第一设备。该方法可包括如下步骤:
S601、设备A和设备B各自设置广播报文过滤规则。
示例性地,某个设备的广播报文过滤规则中通常可以包括该设备所关心的设备的账号信息和/或所关心设备的设备ID等信息,在此不做限制。可理解的,某个设备设置的广播报文过滤规则中包括的该设备所关心设备的账号信息通常为账号信息的简短值,设备ID通常为设备ID的简短值,在此不做限制。
举个例子,假设设备B的广播报文过滤规则中包括的设备A的设备ID,设备C的设备ID和设备D的设备ID,那么当设备B接收到来自设备A的BLE广播时,设备B可以根据从BLE广播中提取出的设备A的设备ID以及本设备中存储的信息,例如广播报文过滤规则等信息,查看设备A是否已经在设备B中组网上线。如已经组网上线,则说明该设备A已经和设备B完成了组网,因此设备B可以忽略此BLE广播。否则,设备B检查设备B是否与设备A满足组网条件或者设备B是否与设备A具有信任关系。如果设备B与设备A不满足组网条件或者不具备信任关系,那么设备B可以忽略此BLE广播;如果设备B与设备A满足组网条件或者具备信任关系,例如,当设备A的账号信息的简短值和设备B的账号信息的简短值相同时,或者,设备A和设备B之间具有其他信任关系时,设备B进一步确定下一步操作方式。
再举个例子,假设设备B的广播报文过滤规则中包括的设备C的信息和设备D的信息,那么当设备B接收到来自设备A的BLE广播时,由于设备A不是设备B所关心的设备,因此,设备B忽略此BLE广播。
S602、设备A发送BLE广播。
其中,设备A可以通过BLE广播机制向周边设备广播发送BLE广播,例如,以下主要以设备A的周边设备为设备B为例进行示意性说明。相应地,设备B接收来自设备A的BLE广播。其中,本申请实施例中涉及的BLE广播的长度可以为31字节等,具体根据实际场景确定,在此不做限制。
需要说明的是,该BLE广播中可以包括设备A的信息以及设备A的设备更新信息。需要说明的是,BLE广播中可包括多个字段,每个字段用于承载不同的信息,例如BLE广播中的第一字段用于承载设备的设备信息版本号,第二字段用于承载设备的设备更新信息等,在此不做限制。
这里,设备A的信息包括以下信息中的一项或者多项:设备A的账号信息的简短值,设备A的设备ID的简短值,设备A的设备信息版本号(即第一设备信息版本号),广播加密的盐值等信息。示例性地,本申请中涉及的设备A的账号信息的简短值的长度通常为2字节,设备A的设备ID的简短值的长度通常为8字节,设备A的设备信息版本号的长度通常为2字节,广播加密的盐值的长度通常为2字节等,具体根据实际场景确定,在此不做限制。
其中,设备A的设备更新信息包括设备A本次广播相对设备A第一次广播时,设备A的信息的更新部分(或理解为差异部分,或差分部分),以及该更新部分对应的校验值。例如,假设第一次广播时,设备A的Wi-Fi未被打开,设备A未亮屏,设备A的手电筒开关为关闭,而本次广播时,设备A的Wi-Fi已经被打开,设备A已经亮屏,设备A上的手电筒开关依然为关闭,那么设备A的信息的更新部分为Wi-Fi已经被打开,设备A亮屏。示例性地,本申请中涉及的更新部分对应的校验值的长度通常为1字节。
可理解的,设备A的设备更新信息可以为明文信息(即设备A的信息更新部分和更新部分对应的校验值皆为明文信息),或者,设备A的设备更新信息也可以为基于广播密钥对设备A的信息更新部分和更新部分对应的校验值进行加密后的密文信息。也就是说,是否基于设备A的广播密钥对设备A发送的BLE广播中携带的设备A的设备更新信息进行加密的步骤为可选步骤,加密有利于提高广播的安全性,防止攻击者攻击。
可理解的,若设备A的设备更新信息为明文信息,则后续可直接基于校验值对设备A的信息更新部分进行完整性校验;若设备A的设备更新信息为密文信息,则需要先基于广播加密的盐值和设备A的广播密钥对密文信息进行解密,再基于校验值对设备A的信息更新部分进行完整性校验,以便进行后续流程。为方便理解,后续主要以设备A的设备更新信息为密文信息为例进行示意性说明。
具体地,如果设备B根据BLE广播中包括的设备A的账号信息的简短值和/或设备A的设备ID的简短值,再结合存储的设备B的信息确定设备B与设备A满足组网条件或者具备信任关系,那么设备B可以进一步判断需要执行的下一步操作。这里,下一步操作可以为执行首次组网流程(如图6中步骤S603a~S607a),或者,执行非首次组网流程(如图6中步骤S603b~S606b)。
其中,当出现以下任意一种情况时,需要执行如图6中步骤S603a~S605a所示的首次组网流程:
情况1、当设备B中未存储有设备A的设备信息版本号(即第二设备信息版本号)时,可以执行首次组网流程。这里,设备B中未存储有设备A的设备信息版本号的原因可能有:1、设备A和设备B之间未组过网;2、设备A和设备B之间组过网,但是设备B在组网后关机重启过,因此使设备B中存储的设备A的设备信息
皆被删除。
情况2、当BLE广播中包括设备A的设备信息版本号(即第一设备信息版本号),设备B中存储有设备A的设备信息版本号(即第二设备信息版本号),且BLE广播中包括设备A的设备信息版本号与设备B中存储的设备A的设备信息版本号不一致时,可以执行首次组网流程。
可选的,当BLE广播中包括设备A的设备信息版本号,设备B中存储有设备A的设备信息版本号,且BLE广播中包括设备A的设备信息版本号与设备B中存储的设备A的设备信息版本号一致时,执行非首次组网流程,即执行如图6中步骤S603b~S606b。
首次组网流程:
S603a、设备B与设备A建立BLE连接。
具体地,设备B向设备A发起BLE连接请求,以请求建立设备B与设备A之间的BLE连接。其中,有关设备B与设备A之间建立BLE连接的详细过程可参见BLE GATT协议的描述,在此不再赘述。
S604a、设备A/B进行认证,派生通信密钥。
其中,设备A和设备B可以进行交互,以完成对双方身份的确认或认证,并在此过程中生日设备间的通信密钥。其中,通信密钥可以是对称密钥等,在此不做限制。
可选的,在上述情况3中,若设备A的设备信息版本号发生变化的原因为当前设备信息相较第一次广播时设备A的设备信息变化太大,其差异部分的数据量大小已经超出了广播可携带的范围,那么该步骤S604a为可选步骤,也就是说,在上述情况2中,可以通过建立BLE连接,但不进行认证的方式来加速上线。
S605a、使用通信密钥通信,以交换设备的详细信息。
其中,设备A和设备B可以分别生成自身的设备信息版本号。可理解的,设备A的设备信息版本号用于标示设备A的设备信息的当前版本,设备B的设备信息版本号用于标示设备B的设备信息的当前版本。
可选的,设备A和设备B在分别生成自身的设备信息版本号时,还可以生成各自的广播密钥。可理解的,设备A的广播密钥与设备A的设备信息版本号相关或匹配,设备B的广播密钥与设备B的设备信息版本号相关或匹配。也就是说,当某个设备的设备信息版本号发生变化时,该设备的广播密钥也会发生变化。
通常来说,设备信息版本号可采用随机,或是递增的方式生产,只需不重复即可,又因其需要在广播中携带,因此可设置其长度为2字节,以减少对广播的开销。
可理解的,设备信息版本号发生变化主要有以下三种原因:原因一:本次设备信息相较第一次广播时设备A的设备信息变化太大,其差异部分的数据量大小已经超出了广播可携带的范围;原因二:本次设备信息中的关键信息发生了变化,例如设备名称发生了变化,而将这些关键信息通过广播携带会存在隐私风险;原因三:设备间信任关系发生了变化,如设备账号发生了变化。
可理解的,设备A可以使用通信密钥向设备B发送设备A的详细信息,该设备A的详细信息中可以包括设备A的设备信息版本号,或者,该设备A的详细信息中可以包括设备A的设备信息版本号和设备A广播密钥。相应地,设备B也可以使用通信密钥向设备A发送设备B的详细信息,该设备B的详细信息中可以包括设备B的设备信息版本号,或者,该设备B的详细信息中可以包括设备B的设备信息版本号和设备B的广播密钥等信息。可选的,设备的详细信息中还可以包括设备间的通信密钥,MAC地址信息,IP地址信息,设备的完整设备ID,完整账号信息,设备的版本号、蓝牙的版本号,设备名称等,在此不做限制。
S606a、设备A存储接收到的与设备B相关的所有信息,设备B存储接收到的与设备A相关的所有信息。
具体地,设备A可以将接收到的与设备B相关的所有信息持久化保存在设备A的本地文件系统(即本地磁盘)中或云端中,设备B可以将接收到的与设备A相关的所有信息持久化保存在设备B的本地文件系统中或云端中等,在此不做限制。
可选的,设备A也可以将接收到的与设备B相关的所有信息只保存在内存中,设备B也可以将接收到的与设备A相关的所有信息只保存在内存中。可理解的,当保存在内存中时,设备关机重启之后该设备保存的信息将被初始化或清除或删除。
S607a、组网成功,设备B在设备A中上线,设备A在设备B中上线。
需要说明的是,本申请实施例设备A和设备B在首次组网后,设备A会将与设备B相关的所有信息,例如设备B的设备信息版本号、设备B的广播密钥、设备A和设备B之间的通信密钥进行保存,同样地,设备B也会将与设备A相关的所有信息,例如设备A的设备信息版本号、设备A的广播密钥、设备A和设备B之间的通信密钥进行保存。即使后续设备下线后,也不会删除本设备中保存的对端设备的设备信息,但是在设备间解除信任关系时,可以删除保存的对端设备的设备信息。
非首次组网流程:
S603b、设备B恢复设备B中存储的设备A的设备信息,并根据恢复的设备A的设备信息和BLE广播中设备A的设备更新信息,更新设备B中存储的设备A的设备信息。
需要说明的是,如果BLE广播中设备A的设备信息版本号与设备B中存储的设备A的设备信息版本号的一致,那么设备B可以恢复设备B中存储的设备A的设备信息,这里,设备B中存储的设备A的设备信息可以是首次组网后得到的设备A的设备信息。可理解的,本申请实施例中的“恢复”可以理解为重新读取或重新加载设备B中存储的设备A的设备信息。进一步地,设备B可以根据恢复的设备A的设备信息和BLE广播中设备A的设备更新信息,更新设备B中存储的设备A的设备信息,具体地,详细过程描述如下:
在一种实现中,设备B可以从设备B中存储的设备A的设备信息中提取出该设备A的广播密钥,并基于广播密钥对密文信息进行解密,以得到设备A的信息更新部分的明文信息,以及更新部分对应的校验值的明文信息。然后,基于校验值对设备A的信息更新部分进行完整性校验。
示例性地,设备B可按照预设或预配置的运算方法对设备A的信息更新部分进行计算得到一个简短值,并比较计算出的简短值与校验值是否相同。如果计算出的简短值与校验值相同,则确定设备A的信息更新部分的内容完整,因此,后续可根据设备B中存储的设备A的设备信息,再结合设备A的信息更新部分,生成最新的设备A的设备信息,并对生成的最新的设备A的设备信息进行保存。相反的,如果计算出的简短值与校验值不相同,则执行上述步骤S603a~S605a的首次组网流程。这里,设备B保存的设备A的设备信息可以包括设备A与设备B之间的通信密钥,设备A的MAC地址信息,设备A的IP地址信息,设备A的完整设备ID,设备A的完整账号信息,设备A的版本号、设备A的蓝牙的版本号,设备A的设备名称,设备A的设备信息版本号,设备A的设备信息版本号,设备A广播密钥等中的一项或者多项,在此不做限制。相应地,设备A保存的设备B的设备信息可以包括设备A与设备B之间的通信密钥,设备B的MAC地址信息,设备B的IP地址信息,设备B的完整设备ID,设备B的完整账号信息,设备B的版本号、设备B的蓝牙的版本号,设备B的设备名称,设备B的设备信息版本号,设备B的设备信息版本号,设备B广播密钥等中的一项或者多项,在此不做限制。
可选的,设备B还可以根据BLE广播中携带的信息确定是否恢复设备B和设备A之间的通信,这里,设备B恢复设备B和设备A之间的通信可以理解为设备B使用设备B和设备A之间的通信密钥与设备A进行通信(即设备B采用设备B中存储的设备A与设备B之间的通信密钥向设备A发送通信数据)。具体地,可以有如下两种实现方式:
在一种实现中,当BLE广播中包括的设备A的设备信息版本号与设备B中存储中的设备A的设备信息版本号相同,则确定可以直接恢复设备B和设备A之间的通信。也就是说,当确定BLE广播中包括的设备A的设备信息版本号与设备B中存储中的设备A的设备信息版本号相同时,设备B可以立即恢复设备B和设备A之间的通信(即设备B采用设备B中存储的设备A与设备B之间的通信密钥向设备A发送通信数据),这样有利于提高通信效率。
在另一种实现中,BLE广播中还可以包括通信密钥简短值集合或者通信密钥简短值列表,其中该通信密钥简短值集合或者通信密钥简短值列表中包括一个或者多个通信密钥简短值。例如,多个通信密钥简短值中可以包括设备A与设备B之间通信密钥的简短值。因此,设备B在接收到BLE广播后,可以对设备B中存储的设备A的广播密钥按预设或预配置的运算方法进行计算得到一个简短值,并比较BLE广播中携带的设备A与设备B之间通信密钥的简短值与计算出的设备A与设备B之间通信密钥的简短值是否相同,如果相同,则设备B和设备A之间的通信可以恢复。
需要说明的是,若BLE广播中携带了多个设备与设备A之间的通信密钥的简短值,那么设备B需遍历所有简短值进行匹配校验,当BLE广播中携带的多个通信密钥的简短值中存在任一个简短值与计算出的设备A与设备B之间通信密钥的简短值相同时,即可以恢复设备B和设备A之间的通信,若BLE广播中不存在与计算出的设备A与设备B之间通信密钥的简短值相同的简短值,则说明不可恢复。可理解的,若设备间的通信不可恢复,则可以重新执行上述步骤S603a~S605a的首次组网流程。
示例性地,请参见图7,图7是本申请实施例提供的一种设备间通信恢复的示意图。如图7所示:
①设备A和设备B认证后,设备A和设备B之间将保存设备A与设备B之间的通信密钥(Kab),A保存B的广播密钥(b),B保存A的广播密钥(a)。
②设备A和设备C认证后,设备A和设备C之间将保存设备A与设备C之间的通信密钥(Kac),A保存C的广播密钥(c),C保存A的广播密钥(a)。
③设备B收到设备A发送的BLE广播后,用设备A的广播密钥(a)解密广播内容,检查广播中是否携带通信密钥(Kab)的简短值,有则认为设备A与设备B之间的通信密钥(Kab)可恢复,即设备A与设备B之间的通信可恢复,否则认为不可恢复。相应地,设备C收到设备A发送的BLE广播后,用设备A的广播密钥(a)解密广播内容,检查广播中是否携带通信密钥(Kac)的简短值,有则认为设备A与设备C之间的通信密钥(Kac)可恢复,即设备A与设备C之间的通信可恢复,否则认为不可恢复。
可理解的,本申请实施例中涉及的通信密钥的简短值的长度可以为3字节,以减少对广播的开销。
可理解的,本申请中的通信密钥简短值集合或者通信密钥简短值列表可以通过TLV格式携带。其中TLV是一种可变的格式,T表示类型(Type),L表示长度(Length),V表示具体的值(Value)。例如以设备A包含有设备B和设备C的通信密钥为例,其中,T为1时,表示类型为通信密钥简短值;L为6,表示通信密钥简短值的长度一共为6字节,即设备B和设备C的通信密钥简短值分别为3字节,因此一共有6字节;V为设备B的通信密钥的简短值和设备C的通信密钥的简短值。
需要说明的是,上述计算设备A的信息更新部分对应的简短值的计算方法与计算设备B中存储的设备A的广播密钥对应的简短值的计算方法可以相同,也可以不同,在此不做限制。其中,本申请实施例中预设或预配置的简短值计算方法具体可以为哈希算法,例如,哈希算法可以包括MD系列哈希算法、SHA哈希算法以及SM3杂凑算法等,在此不做限制,其中MD系列哈希算法可以包括MD2,MD4和MD5等,SHA哈希算法可以包括SHA-1,SHA-224,SHA-256,SHA-384,SHA-512等,在此不做限制。
S604b、设备B发送BLE广播。
其中,设备B根据设备A发送的BLE广播中携带的设备A的设备更新信息恢复出设备A的设备信息之后,设备B可以通过BLE广播机制向周边设备回复BLE广播,例如,以下主要以设备B的周边设备为设备A为例进行示意性说明。相应地,设备A接收来自设备B的BLE广播。
其中,设备B回复的BLE广播中可以包括设备B的信息以及设备B的设备更新信息。具体地,有关设备B发送的BLE广播的描述,以及设备A接收到来自设备B的BLE广播,并对BLE广播的处理过程可参见上述有关设备A发送的BLE广播,以及设备B接收到来自设备A的BLE广播,并对BLE广播的处理过程的描述,在此不再进行赘述。
S605b、组网成功,设备B在设备A中上线,设备A在设备B中上线。
其中,在非首次组网场景下,不需要进行BLE连接,即可实现设备间组网,并能恢复通信密钥,提高了组网上线的效率。
可理解的,当上述S604b~S606b中的非首次组网流程中任意一个步骤或操作执行失败时,都可以重新执行上述步骤S603a~S605a的首次组网流程,以实现设备间组网。
需要说明的是,本申请实施例在首次组网场景中,需要完成设备的设备信息版本号和广播密钥的生成和交换,以及设备信息、通信密钥、设备信息版本号和广播密钥的存储。而非首次组网场景可以理解为设备间曾经成功组网过,但由于设备关机或设备间距离太远而断开了组网,后续又因为设备重新开机或设备再次靠近,而需要再次组网的场景。其中,在非首次组网场景下,由于本设备存储有其他设备的设备信息、其他设备的设备信息版本号、其他设备的广播密钥和其他设备与本设备间的通信密钥,以及存储有本设备的设备信息、本设备的设备信息版本号以及本设备的广播密钥等信息,因此,在非首次组网场景下时,通过提取BLE广播中的设备信息版本号和差分部分,再结合上次获取的设备信息,可以快速组网,而不必建立BLE连接以及执行认证这个耗时耗资源的流程,进而加速了组网流程。
请参见图8,图8是本申请实施例提供的基于BLE的通信方法的另一流程示意图。如图8所示,该通信方法包括如下步骤S801和步骤S803。图8所示的方法执行主体可以为第一设备或第一设备中的芯片。为方便描述,图8以第一设备为方法的执行主体为例进行说明。其中:
S801、第一设备接收来自第二设备的BLE广播。
在一些可行的实施方式中,第二设备发送BLE广播,相应地,第一设备接收来自第二设备的BLE广播。其中,该BLE广播包括第一字段,第一字段用于承载第二设备的第一设备信息版本号,第一设备信息版本号用于指示第二设备的当前设备信息的版本。需要说明的是,本申请中的设备信息版本号也可以理解为是一种设备信息标识或设备信息索引,该设备信息标识或设备信息索引用于标记设备信息。例如第二设备发送的BLE广播中包括的第一设备信息标识或第一设备信息索引用于标记该第二设备的当前设备信息。
这里,有关BLE广播的详细理解可参见上述图6中步骤S602中的相关描述,在此不再赘述。其中图8中的第二设备相当于图6中的电子设备A(简称设备A),第一设备相当于电子设备B(简称设备B)。
可选的,在步骤S801之前,第一设备和第二设备还可以各自设置自身的广播报文过滤规则,避免被非关心的BLE广播给唤醒和通知。
S802、第一设备确定第一设备中存储有第二设备的设备信息。
在一些可行的实施方式中,第一设备确定第一设备中是否存储有第二设备的设备信息。当第一设备确定第一设备中未存储有第二设备的设备信息时,第一设备执行首次组网流程,这里,有关首次组网流程的理解可参见上述图6中首次组网流程的相关描述,在此不再赘述。当第一设备确定第一设备中存储有第二设备的设备信息时,第一设备读取存储的第二设备的设备信息中包括的第二设备的第二设备信息版本号,其中该第二设备信息版本号用于指示第一设备中存储的第二设备的设备信息的版本。进而,第一设备比较第一设备信息版本号与第二设备信息版本号是否相同。
S803、若第一设备信息版本号与第二设备信息版本号相同,则恢复第一设备中存储的第二设备的设备信息。
在一些可行的实施方式中,若第一设备信息版本号与第二设备信息版本号相同,则第一设备恢复第一设备中存储的第二设备的设备信息。可选的,第一设备还可以根据恢复的第二设备的设备信息和BLE广播中第二设备的设备更新信息,更新设备B中存储的第二设备的设备信息。也就是说,当第一设备信息版本号与第二设备信息版本号相同时,可执行非首次组网流程,这里,有关S803的详细描述可参见图6中非首次组网流程的相关描述,在此不再赘述。
S804、若第一设备信息版本号和第二设备信息版本号不相同,则向第二设备发送BLE建立请求,以建立第二设备和第一设备之间的BLE连接。
在一些可行的实施方式中,若第一设备信息版本号和第二设备信息版本号不相同,则向第二设备发送BLE建立请求,以建立第二设备和第一设备之间的BLE连接。可选的,第一设备进一步可以通过BLE连接接收来自第二设备的第二设备的设备信息,并存储来自第二设备的第二设备的设备信息。也就是说,当第一设备信息版本号和第二设备信息版本号不相同时,可执行首次组网流程,这里,有关S803的详细描述可参见图6中首次组网流程的相关描述,在此不再赘述。
下面将结合图9~图10对本申请提供的通信装置进行详细说明。
请参见图9,图9是本申请实施例提供的一种通信装置的结构示意图。图9所示的通信装置900可以用于执行上述图6和/或图8所描述的方法实施例中终端设备(例如设备A或设备B)的部分或全部功能。该装置可以是终端设备,也可以是终端设备中的装置,或者是能够和终端设备匹配使用的装置。其中,该通信装置900还可以为芯片系统。图9所示的通信装置可以包括蓝牙模块901,处理模块902和存储模块903。其中,处理模块902,用于进行数据处理。蓝牙模块901用于接收或发送数据。存储模块903用于存储数据。其中:
在一种实现中:
蓝牙模块901,用于接收来自第二设备的低功耗蓝牙BLE广播,所述BLE广播包括第一字段,所述第一字段用于承载所述第二设备的第一设备信息版本号,所述第一设备信息版本号用于指示所述第二设备的当前设备信息的版本;
处理模块902,用于确定所述第一设备的存储模块903中存储有所述第二设备的设备信息,所述第二设备的设备信息包括所述第二设备的第二设备信息版本号,所述第二设备信息版本号用于指示所述存储模块903中存储的所述第二设备的设备信息的版本;
若所述第一设备信息版本号与所述第二设备信息版本号相同,则所述处理模块902恢复所述存储模块903中存储的所述第二设备的设备信息。
在一种可能的实现中,所述处理模块902,还用于若所述第一设备信息版本号和所述第二设备信息版本号不相同,则通过所述蓝牙模块901向所述第二设备发送BLE建立请求,以建立所述第二设备和所述第一设备之间的BLE连接;
所述蓝牙模块901,还用于通过所述BLE连接接收来自所述第二设备的所述第二设备的设备信息;
所述存储模块903,用于存储所述来自所述第二设备的所述第二设备的设备信息。
在一种可能的实现中,所述BLE广播还包括第二字段,所述第二字段用于承载所述第二设备的设备更新信息;
所述处理模块902还用于:
根据恢复的所述第二设备的设备信息和所述第二设备的设备更新信息,更新所述第二设备的设备信
息。
在一种可能的实现中,所述第二设备的设备更新信息包括信息更新部分和所述信息更新部分对应的校验值;
所述根据恢复出的所述第二设备的设备信息和所述第二设备的设备更新信息,更新所述第二设备的设备信息时,所述处理模块902用于:
根据所述校验值对所述信息更新部分进行完整性校验;
若所述完整性校验的校验结果为校验通过,则根据所述信息更新部分和所述第二设备中存储的第二设备的设备信息更新并存储所述第二设备的设备信息。
在一种可能的实现中,所述BLE广播中还包括广播加密的盐值,所述第二设备的设备更新信息为基于所述第二设备的广播密钥对所述信息更新部分和所述信息更新部分对应的校验值进行加密的密文信息;
所述根据所述校验值对所述信息更新部分进行完整性校验之前,所述处理模块902用于:
根据所述广播加密的盐值和所述第二设备的广播密钥对所述密文信息进行解密,得到所述信息更新部分和所述信息更新部分对应的校验值。
在一种可能的实现中,所述BLE广播中还包括通信密钥简短值列表;所述存储模块903中存储的所述第二设备的设备信息包括所述第二设备与所述第一设备之间的通信密钥;
所述处理模块902还用于:
所述第一设备确定所述第二设备与所述第一设备之间的通信密钥对应的通信密钥简短值;
若所述通信密钥简短值列表中包括所述通信密钥简短值,则通过所述蓝牙模块901采用所述存储模块903中存储的所述第二设备与所述第一设备之间的通信密钥向所述第二设备发送通信数据。
在一种可能的实现中,所述存储模块903中存储的所述第二设备的设备信息包括所述第二设备与所述第一设备之间的通信密钥;
所述蓝牙模块901还用于:
采用所述存储模块903中存储的所述第二设备与所述第一设备之间的通信密钥向所述第二设备发送通信数据。
在一种可能的实现中,所述BLE广播中还包括所述第二设备的账号信息的简短值和/或所述第二设备的设备标识的简短值;
所述确定所述第一设备中存储有所述第二设备的设备信息之前,所述处理模块902还用于:
根据所述第二设备的账号信息的简短值和/或所述第二设备的设备标识的简短值确定所述第二设备与所述第一设备之间是否具有信任关系;
在所述第一设备确定所述第二设备与所述第一设备之间具有信任关系时,确定所述第一设备中存储有所述第二设备的设备信息。
在一种可能的实现中,所述蓝牙模块901还用于:
发送BLE广播,所述BLE广播用于所述第二设备恢复并更新所述第二设备中存储的所述第一设备的设备信息。
在另一种实现中:
蓝牙模块901,用于向第一设备发送低功耗蓝牙BLE广播,所述BLE广播包括第一字段,所述第一字段用于承载所述第二设备的第一设备信息版本号,所述第一设备信息版本号用于指示所述第二设备的当前设备信息的版本。
在一种可能的实现中,所述蓝牙模块901还用于:
接收来自所述第一设备的BLE建立请求,以建立所述第二设备和所述第一设备之间的BLE连接;
通过所述BLE连接向所述第一设备发送所述第二设备的设备信息。
在一种可能的实现中,所述BLE广播还包括第二字段,所述第二字段用于承载所述第二设备的设备更新信息。
在一种可能的实现中,所述第二设备的设备更新信息包括信息更新部分和所述信息更新部分对应的校验值。
在一种可能的实现中,所述BLE广播中还包括广播加密的盐值,所述第二设备的设备更新信息为基于所述第二设备的广播密钥对所述信息更新部分和所述信息更新部分对应的校验值进行加密的密文信息。
在一种可能的实现中,所述蓝牙模块901还用于:
接收来自所述第一设备的通信数据。
在一种可能的实现中,所述蓝牙模块901还用于:
接收来自所述第一设备的BLE广播;
所述装置还包括处理模块902:
所述处理模块902,用于根据所述BLE广播恢复并更新所述第二设备的存储模块903中存储的所述第一设备的设备信息。
该通信装置的其他可能的实现方式,可参见上述图6和/或图8对应的方法实施例中对终端设备功能的相关描述,在此不赘述。
请参见图10,图10是本申请实施例提供的另一种通信装置的结构示意图。如图10所示,该通信装置1000可以为本申请实施例中描述的终端设备,用于实现上述图6和/或图8中终端设备的功能。为了便于说明,图10仅示出了终端设备的主要部件。如图10所示,通信装置1000包括处理器1001、存储器1002和蓝牙1003。处理器1001主要用于对通信协议以及通信数据进行处理,以及对整个通信装置1000进行控制,执行软件程序,处理软件程序的数据。存储器1002主要用于存储软件程序和数据。蓝牙1003主要用于通过蓝牙空口接收数据或发送数据。
以通信装置1000为手机为例,当通信装置1000开机后,处理器1001可以读取存储器1002中的软件程序,解释并执行软件程序的指令,处理软件程序的数据。当需要通过蓝牙1003发送数据时,处理器对待发送的数据进行处理后,通过蓝牙发送数据。当有数据发送到通信装置1000时,处理器1001通过蓝牙1003接收信号,并将接收到的信号转换为数据,以对该数据进行处理。
本领域技术人员可以理解,为了便于说明,图10仅示出了一个存储器和一个处理器。在一些实施例中,通信装置1000可以包括多个处理器和存储器。存储器也可以称为存储介质或者存储设备等,本申请实施例对此不做限制。
作为一种可选的实现方式,处理器可以包括基带处理器和中央处理器,基带处理器主要用于对通信协议以及通信数据进行处理,中央处理器主要用于对整个通信装置1000进行控制,执行软件程序,处理软件程序的数据。图10中的处理器集成了基带处理器和中央处理器的功能,本领域技术人员可以理解,基带处理器和中央处理器也可以是各自独立的处理器,通过总线等技术互联。通信装置1000可以包括多个基带处理器以适应不同的网络制式,通信装置1000可以包括多个中央处理器以增强其处理能力,通信装置1000的各个部件可以通过各种总线连接。所述基带处理器也可以表述为基带处理电路或者基带处理芯片。所述中央处理器也可以表述为中央处理电路或者中央处理芯片。对通信协议以及通信数据进行处理的功能可以内置在处理器中,也可以以软件程序的形式存储在存储单元中,由处理器执行软件程序以实现基带处理功能。
作为一种可选的实现方式,该存储器可以包括只读存储器和随机存取存储器,并向处理器提供指令和数据。存储器的一部分还可以包括非易失性随机存取存储器等,在此不做限制。
本申请实施例还提供一种计算机可读存储介质,该计算机可读存储介质中存储有指令,当其在处理器上运行时,上述方法实施例的方法流程得以实现。
本申请实施例还提供一种计算机程序产品,当所述计算机程序产品在处理器上运行时,上述方法实施例的方法流程得以实现。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令
用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的计算机可读存储介质,可以是计算机能够存取的任何可用介质。以此为例但不限于:计算机可读介质可以包括随机存取存储器(random access memory,RAM)、只读存储器(read-only memory,ROM)、可编程只读存储器(programmable ROM,PROM)、可擦除可编程只读存储器(erasable PROM,EPROM)、电可擦可编程只读存储器(electrically erasable programmable read only memory,EEPROM)、紧凑型光盘只读存储器(compact disc read-only memory,CD-ROM)、通用串行总线闪存盘(universal serial bus flash disk)、移动硬盘、或其他光盘存储、磁盘存储介质或者其他磁存储设备、或者能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质。另外,通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(static RAM,SRAM)、动态随机存取存储器(dynamic RAM,DRAM)、同步动态随机存取存储器(synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(double data rate SDRAM,DDR SDRAM)、增强型同步动态随机存取存储器(enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(synchlink DRAM,SLDRAM)或直接内存总线随机存取存储器(direct rambus RAM,DR RAM)。
以上所述,仅为本申请的具体实施方式,但本申请实施例的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请实施例揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请实施例的保护范围之内。因此,本申请实施例的保护范围应所述以权利要求的保护范围为准。
Claims (19)
- 一种通信方法,其特征在于,所述方法包括:第一设备接收来自第二设备的低功耗蓝牙BLE广播,所述BLE广播包括第一字段,所述第一字段用于承载所述第二设备的第一设备信息版本号,所述第一设备信息版本号用于指示所述第二设备的当前设备信息的版本;所述第一设备确定所述第一设备中存储有所述第二设备的设备信息,所述第二设备的设备信息包括所述第二设备的第二设备信息版本号,所述第二设备信息版本号用于指示所述第一设备中存储的所述第二设备的设备信息的版本;若所述第一设备信息版本号与所述第二设备信息版本号相同,则所述第一设备恢复所述第一设备中存储的所述第二设备的设备信息。
- 根据权利要求1所述的方法,其特征在于,所述方法还包括:若所述第一设备信息版本号和所述第二设备信息版本号不相同,则所述第一设备向所述第二设备发送BLE建立请求,以建立所述第二设备和所述第一设备之间的BLE连接;所述第一设备通过所述BLE连接接收来自所述第二设备的所述第二设备的设备信息;所述第一设备存储所述来自所述第二设备的所述第二设备的设备信息。
- 根据权利要求1所述的方法,其特征在于,所述BLE广播还包括第二字段,所述第二字段用于承载所述第二设备的设备更新信息;所述方法还包括:所述第一设备根据恢复的所述第二设备的设备信息和所述第二设备的设备更新信息,更新所述第二设备的设备信息。
- 根据权利要求3所述的方法,其特征在于,所述第二设备的设备更新信息包括信息更新部分和所述信息更新部分对应的校验值;所述第一设备根据恢复出的所述第二设备的设备信息和所述第二设备的设备更新信息,更新所述第二设备的设备信息,包括:所述第一设备根据所述校验值对所述信息更新部分进行完整性校验;若所述完整性校验的校验结果为校验通过,则所述第一设备根据所述信息更新部分和所述第二设备中存储的第二设备的设备信息更新并存储所述第二设备的设备信息。
- 根据权利要求4所述的方法,其特征在于,所述BLE广播中还包括广播加密的盐值,所述第二设备的设备更新信息为基于所述第二设备的广播密钥对所述信息更新部分和所述信息更新部分对应的校验值进行加密的密文信息;所述第一设备根据所述校验值对所述信息更新部分进行完整性校验之前,所述方法还包括:所述第一设备根据所述广播加密的盐值和所述第二设备的广播密钥对所述密文信息进行解密,得到所述信息更新部分和所述信息更新部分对应的校验值。
- 根据权利要求1-5任一项所述的方法,其特征在于,所述BLE广播中还包括通信密钥简短值列表;所述第一设备中存储的所述第二设备的设备信息包括所述第二设备与所述第一设备之间的通信密钥;所述方法还包括:所述第一设备确定所述第二设备与所述第一设备之间的通信密钥对应的通信密钥简短值;若所述通信密钥简短值列表中包括所述通信密钥简短值,则所述第一设备采用所述第一设备中存储的所述第二设备与所述第一设备之间的通信密钥向所述第二设备发送通信数据。
- 根据权利要求1-5任一项所述的方法,其特征在于,所述第一设备中存储的所述第二设备的设备信息包括所述第二设备与所述第一设备之间的通信密钥;所述方法还包括:所述第一设备采用所述第一设备中存储的所述第二设备与所述第一设备之间的通信密钥向所述第二 设备发送通信数据。
- 根据权利要求1-7任一项所述的方法,其特征在于,所述BLE广播中还包括所述第二设备的账号信息的简短值和/或所述第二设备的设备标识的简短值;所述第一设备确定所述第一设备中存储有所述第二设备的设备信息之前,所述方法还包括:所述第一设备根据所述第二设备的账号信息的简短值和/或所述第二设备的设备标识的简短值确定所述第二设备与所述第一设备之间是否具有信任关系;在所述第一设备确定所述第二设备与所述第一设备之间具有信任关系时,所述第一设备确定所述第一设备中存储有所述第二设备的设备信息。
- 根据权利要求1-8任一项所述的方法,其特征在于,所述方法还包括:所述第一设备发送BLE广播,所述第一设备发送的所述BLE广播用于所述第二设备恢复并更新所述第二设备中存储的所述第一设备的设备信息。
- 一种通信方法,其特征在于,所述方法包括:第二设备向第一设备发送低功耗蓝牙BLE广播,所述BLE广播包括第一字段,所述第一字段用于承载所述第二设备的第一设备信息版本号,所述第一设备信息版本号用于指示所述第二设备的当前设备信息的版本。
- 根据权利要求10所述的方法,其特征在于,所述方法还包括:接收来自所述第一设备的BLE建立请求,以建立所述第二设备和所述第一设备之间的BLE连接;所述第二设备通过所述BLE连接向所述第一设备发送所述第二设备的设备信息。
- 根据权利要求10或11所述的方法,其特征在于,所述BLE广播还包括第二字段,所述第二字段用于承载所述第二设备的设备更新信息。
- 根据权利要求12所述的方法,其特征在于,所述第二设备的设备更新信息包括信息更新部分和所述信息更新部分对应的校验值。
- 根据权利要求13所述的方法,其特征在于,所述BLE广播中还包括广播加密的盐值,所述第二设备的设备更新信息为基于所述第二设备的广播密钥对所述信息更新部分和所述信息更新部分对应的校验值进行加密的密文信息。
- 根据权利要求10-13任一项所述的方法,其特征在于,所述方法还包括:所述第二设备接收来自所述第一设备的通信数据。
- 根据权利要求10-13任一项所述的方法,其特征在于,所述方法还包括:所述第二设备接收来自所述第一设备的BLE广播,所述第二设备基于所述第一设备发送的所述BLE广播恢复并更新所述第二设备中存储的所述第一设备的设备信息。
- 一种电子设备,其特征在于,包括:一个或多个处理器、存储器和蓝牙模块;所述存储器用于存储计算机程序代码,所述计算机程序代码包括计算机指令,当所述一个或多个处理器执行所述计算机指令时,使得所述电子设备执行如权利要求1-9中任一项所述的通信方法,或者,执行如权利要求10-16中任一项所述的通信方法。
- 一种计算机存储介质,其特征在于,包括计算机指令,当所述计算机指令在电子设备上运行时,使得所述电子设备执行如权利要求1-9中任一项所述的通信方法,或者,执行权利要求10-16中任一项所述的通信方法。
- 一种计算机程序产品,其特征在于,当所述计算机程序产品在计算机上运行时,使得所述计算机执行如权利要求1-9中任一项所述的通信方法,或者,执行权利要求10-16中任一项所述的通信方法。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210999884.0 | 2022-08-19 | ||
CN202210999884.0A CN117641256A (zh) | 2022-08-19 | 2022-08-19 | 通信方法及相关装置 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2024037500A1 true WO2024037500A1 (zh) | 2024-02-22 |
Family
ID=89940738
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2023/112905 WO2024037500A1 (zh) | 2022-08-19 | 2023-08-14 | 通信方法及相关装置 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN117641256A (zh) |
WO (1) | WO2024037500A1 (zh) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2018000134A1 (zh) * | 2016-06-27 | 2018-01-04 | 华为技术有限公司 | 一种蓝牙连接的方法及终端 |
CN112423241A (zh) * | 2020-11-17 | 2021-02-26 | 江门市征极光兆科技有限公司 | 智能设备、智能设备的控制方法及控制系统 |
CN112449328A (zh) * | 2019-08-30 | 2021-03-05 | 华为技术有限公司 | 一种蓝牙搜索方法、系统及相关装置 |
CN113778484A (zh) * | 2021-09-03 | 2021-12-10 | 珠海格力电器股份有限公司 | 升级设备固件的方法、装置、系统、电子设备及存储介质 |
-
2022
- 2022-08-19 CN CN202210999884.0A patent/CN117641256A/zh active Pending
-
2023
- 2023-08-14 WO PCT/CN2023/112905 patent/WO2024037500A1/zh unknown
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2018000134A1 (zh) * | 2016-06-27 | 2018-01-04 | 华为技术有限公司 | 一种蓝牙连接的方法及终端 |
CN112449328A (zh) * | 2019-08-30 | 2021-03-05 | 华为技术有限公司 | 一种蓝牙搜索方法、系统及相关装置 |
CN112423241A (zh) * | 2020-11-17 | 2021-02-26 | 江门市征极光兆科技有限公司 | 智能设备、智能设备的控制方法及控制系统 |
CN113778484A (zh) * | 2021-09-03 | 2021-12-10 | 珠海格力电器股份有限公司 | 升级设备固件的方法、装置、系统、电子设备及存储介质 |
Also Published As
Publication number | Publication date |
---|---|
CN117641256A (zh) | 2024-03-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2021052178A1 (zh) | 一种Wi-Fi连接方法及设备 | |
EP3820077A1 (en) | Login method, token sending method, and device | |
EP3843435B1 (en) | Data transmission method and electronic device | |
CN111373713B (zh) | 一种消息传输方法及设备 | |
CN111083804B (zh) | 一种数据传输方法及设备 | |
WO2021043198A1 (zh) | 一种蓝牙配对方法及相关装置 | |
WO2021104448A1 (zh) | 一种密钥信息的同步方法、系统及设备 | |
WO2021175266A1 (zh) | 身份验证方法、装置和电子设备 | |
CN113408016B (zh) | 保存密文的方法和装置 | |
WO2021184264A1 (zh) | 数据保存方法、数据访问方法及相关装置、设备 | |
WO2022143156A1 (zh) | 一种加密通话方法、装置、终端及存储介质 | |
US20240008107A1 (en) | Communication connection establishment method and system, electronic device, and storage medium | |
CN113676879A (zh) | 一种分享信息的方法、电子设备和系统 | |
WO2021227942A1 (zh) | 一种分享信息的方法、电子设备和系统 | |
WO2021037208A1 (zh) | 一种蓝牙连接的方法和电子设备 | |
EP4336356A1 (en) | Screen projection method and related apparatus | |
WO2022174718A1 (zh) | 一种数据备份方法和电子设备 | |
WO2024037500A1 (zh) | 通信方法及相关装置 | |
US20230214532A1 (en) | Permission negotiation method and apparatus during communication, and electronic device | |
CN113950048A (zh) | 连接建立方法、电子设备及存储介质 | |
CN115599596B (zh) | 数据处理方法、电子设备、系统及存储介质 | |
WO2024037040A1 (zh) | 数据处理方法及电子设备 | |
WO2023207758A1 (zh) | 数据处理方法及装置 | |
WO2023246695A1 (zh) | 设备授权方法及电子设备、系统 | |
CN115550919A (zh) | 设备配对认证方法、装置、发送方设备及接收方设备 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 23854401 Country of ref document: EP Kind code of ref document: A1 |