Connection method, device and bluetooth communication system of bluetooth mesh network

CN117939450BActive Publication Date: 2026-09-11GREE ELECTRIC APPLIANCE INC OF ZHUHAI +1
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202410111327.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-01-25
Publication Date
2026-09-11
Estimated Expiration
2044-01-25

AI Technical Summary

Technical Problem

[0004]本申请的主要目的在于提供一种蓝牙mesh网络的连接方法、装置、计算机可读存储介质和蓝牙通信系统,以至少解决现有技术中蓝牙网络在某些节点失效的情况下或存在环境干扰的情况下,信息无法传递到整个网络的问题

Benefits of technology

[0014] According to another aspect of this application, a Bluetooth communication system is provided, comprising: one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs including methods for performing any one of the methods described.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117939450B_ABST
    Figure CN117939450B_ABST
Patent Text Reader

Abstract

The application provides a connection method and device of a Bluetooth mesh network and a Bluetooth communication system. The method comprises the following steps: broadcasting first request information and receiving first feedback information; in the case that the first feedback information supports a Bluetooth low energy function and a mesh protocol stack, obtaining first identification information and sending the first identification information and a first public key to a first target device; in the case that second identification information and a second public key are received, establishing a physical connection between a second target device and the first target device according to the second identification information, and configuring connection parameters of the physical connection according to the second identification information and the second public key to realize data transmission between the first target device and the second target device. The method solves the problem that information cannot be transmitted to the entire network in the case that some nodes of a Bluetooth network are invalid or environmental interference exists in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data communication technology, and more specifically, to a method, apparatus, computer-readable storage medium, and Bluetooth communication system for connecting Bluetooth mesh networks. Background Technology

[0002] Bluetooth Mesh networking is a network communication standard based on Bluetooth Low Energy (BLE) technology, providing a reliable device-to-device communication solution for large-scale device networks. The core feature of this technology is its mesh topology, where each device can communicate with surrounding devices and act as a relay node, forwarding data packets to more distant devices, thus enabling information transmission throughout the network. This point-to-point messaging mechanism allows the network to self-organize and repair, greatly enhancing its robustness and scalability.

[0003] Bluetooth Mesh networks ensure system operation even in the event of node failures or environmental interference, as messages can be transmitted through multiple paths within the network. However, current technology lacks an authentication connection method for Bluetooth Mesh networks. Summary of the Invention

[0004] The main objective of this application is to provide a Bluetooth mesh network connection method, apparatus, computer-readable storage medium, and Bluetooth communication system, so as to at least solve the problem in the prior art that information cannot be transmitted to the entire network when some nodes fail or when there is environmental interference.

[0005] To achieve the above objectives, according to one aspect of this application, a connection method for a Bluetooth mesh network is provided, comprising: broadcasting first request information and receiving first feedback information, wherein the first request information is used to search for available Bluetooth devices in the vicinity, and the first feedback information is used to characterize that a first target device can support Bluetooth Low Energy and a mesh protocol stack, and the first target device is the receiver of a Bluetooth connection; upon receiving the first feedback information, obtaining first identification information and sending the first identification information and a first public key to the first target device, wherein the first identification information is a unique address of a second target device, the first public key is an encrypted public key of the second target device, and the second target device is the initiator of a Bluetooth connection; upon receiving second identification information and a second public key, establishing a physical connection with the first target device based on the second identification information, and configuring connection parameters of the physical connection based on the second identification information and the second public key to realize data transmission between the first target device and the second target device, wherein the second identification information includes at least the unique address of the first target device, and the second public key is an encrypted public key of the first target device.

[0006] Optionally, establishing a physical connection with the first target device based on the second identification information includes: upon receiving the second identification information, encrypting the first authentication information using the second public key to obtain a first broadcast packet and sending the first broadcast packet to the first target device; upon receiving a second broadcast packet, decrypting the second broadcast packet using the second private key to obtain second feedback information, wherein the second broadcast packet is a broadcast packet sent from the first target device to the second target device, and the second feedback information includes whether the first target device has successfully authenticated and second authentication information, and the second private key is the private key corresponding to the second public key; extracting data from the second feedback information to obtain the second authentication information, performing authentication based on the second authentication information, and if authentication is successful, initiating a pairing request to the first target device based on the second identification information; and if the pairing request is approved, establishing a physical connection with the first target device.

[0007] Optionally, configuring the connection parameters of the physical connection according to the second identification information and the second public key to realize data transmission between the first target device and the second target device includes: when the physical connection between the second target device and the first target device is successfully established, reading the mesh protocol stack according to the second identification information to obtain the target protocol and determining the target interface according to the target protocol, wherein the target protocol is the GATT protocol and the target interface is the API interface corresponding to the target protocol; sending a second request message to the first target device through the target interface and receiving a third feedback message, wherein the second request message is used to obtain the attribute table of the first target device and the third feedback message includes the attribute table, wherein the attribute table is used to store the Bluetooth service and service features provided by the first target device; determining multiple first durations and multiple second durations according to the third feedback message, wherein the first duration is the interval duration of data interaction when the first target device implements the Bluetooth service for the second target device, and the second duration is the maximum connection duration of data interaction when the first target device implements the Bluetooth service for the second target device, wherein the first duration and the second duration correspond one-to-one with the Bluetooth service; and configuring the connection parameters according to the first duration and the second duration.

[0008] Optionally, configuring the connection parameters according to the first duration and the second duration includes: determining a target service according to the first duration and the second duration and obtaining a first target value by capturing the characteristic value of the target characteristic corresponding to the target service through the target interface; updating the first target value according to the first duration and the second duration to obtain a second target value, and sending the second target value to the first target device.

[0009] Optionally, after data transmission between the first target device and the second target device is achieved, the method further includes: when the second target device has a data transmission request, obtaining second identification information and a target operation code, wherein the target operation code is used to characterize the message type that the second target device plans to send and the operation performed by the second target device on the first target device; constructing a data packet based on the second identification information and the target operation code to obtain a target data packet, and encrypting the target data packet based on the AES symmetric encryption algorithm to obtain a third broadcast packet; broadcasting the third broadcast packet through a Bluetooth mesh network; and determining that data transmission is successful if a fourth feedback information is received within a preset time period, wherein the fourth feedback information is used to characterize that the first target device has successfully received the third broadcast packet.

[0010] Optionally, encrypting the target data packet using the AES symmetric encryption algorithm to obtain a third broadcast packet includes: obtaining a message authentication code by performing a cryptographic hash function on the target data packet and the second public key; and encrypting the message authentication code and the target data packet using the second public key to obtain the third broadcast packet.

[0011] Optionally, after broadcasting the third broadcast packet via the Bluetooth mesh network, the method further includes: if no fourth feedback information is received within a preset time period, obtaining fifth feedback information, the fifth feedback information being used to indicate that the relay node has successfully received the third broadcast packet; determining a third target device and a fourth target device based on the fifth feedback information, the third target device being the device corresponding to the relay node corresponding to the fifth feedback information with the shortest interval from the current time during data transmission, and the fourth target device being the device corresponding to the previous relay node of the relay node corresponding to the first target device; sending a third request information to the fourth target device, the third request information being used to instruct the fourth target device to broadcast the third broadcast packet to devices in the Bluetooth mesh network other than the third target device.

[0012] According to another aspect of this application, a Bluetooth mesh network connection device is provided, the device comprising: a first receiving unit, configured to broadcast first request information and receive first feedback information, wherein the first request information is used to search for available Bluetooth devices in the vicinity, and the first feedback information is used to indicate that a first target device can support Bluetooth Low Energy and the mesh protocol stack, and the first target device is the receiver of the Bluetooth connection; a first sending unit, configured to, when the first feedback information indicates support for Bluetooth Low Energy and the mesh protocol stack, acquire first identification information and send the first identification information and a first public key to the first target device, wherein the first identification information is a unique address of a second target device, and the first public key is an encrypted public key of the second target device, and the second target device is the initiator of the Bluetooth connection; and a configuration unit, configured to, upon receiving second identification information and a second public key, establish a physical connection with the first target device based on the second identification information, and configure connection parameters of the physical connection based on the second identification information and the second public key to realize data transmission between the first target device and the second target device, wherein the second identification information includes at least the unique address of the first target device, and the second public key is an encrypted public key of the first target device.

[0013] According to another aspect of this application, a computer-readable storage medium is provided, the computer-readable storage medium including a stored program, wherein, when the program is executed, it controls the device on which the computer-readable storage medium is located to perform any of the methods described.

[0014] According to another aspect of this application, a Bluetooth communication system is provided, comprising: one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs including methods for performing any one of the methods described.

[0015] Applying the technical solution of this application, in the above-mentioned Bluetooth mesh network connection method, firstly, a first request message is broadcast and a first feedback message is received. The first request message is used to search for available Bluetooth devices in the vicinity, and the first feedback message is used to indicate that the first target device can support Bluetooth Low Energy and the mesh protocol stack. The first target device is the receiver of the Bluetooth connection. Then, if the first feedback message indicates support for Bluetooth Low Energy and the mesh protocol stack, first identification information is obtained and the first identification information and a first public key are sent to the first target device. The first identification information is the unique address of the second target device, and the first public key is the encrypted public key of the second target device. The second target device is the initiator of the Bluetooth connection. Finally, upon receiving the second identification information and the second public key, a physical connection is established with the first target device based on the second identification information, and the connection parameters of the physical connection are configured based on the second identification information and the second public key to realize data transmission between the first target device and the second target device. The second identification information includes at least the unique address of the first target device, and the second public key is the encrypted public key of the first target device. This application provides a connection method for a Bluetooth mesh network, enabling broadcast communication between devices in the Bluetooth mesh network. Any device can act as a relay node to communicate with other devices, realizing the transmission of information throughout the network. This solves the problem in the prior art where information cannot be transmitted to the entire network when some nodes fail or when there is environmental interference. Attached Figure Description

[0016] Figure 1 A hardware structure block diagram of a mobile terminal for a Bluetooth mesh network connection method provided in an embodiment of this application is shown.

[0017] Figure 2 A flowchart illustrating a Bluetooth mesh network connection method according to an embodiment of this application is shown.

[0018] Figure 3 A flowchart illustrating a specific Bluetooth mesh network connection method according to an embodiment of this application is shown.

[0019] Figure 4 A structural block diagram of a Bluetooth mesh network connection device provided according to an embodiment of this application is shown.

[0020] The above figures include the following reference numerals:

[0021] 102. Processor; 104. Memory; 106. Transmission device; 108. Input / output device. Detailed Implementation

[0022] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.

[0023] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0024] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate for the embodiments of this application described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0025] As described in the background section, existing technologies employ point-to-point connections, which make it difficult to guarantee smooth data transmission in situations with environmental interference or long distances. To address the problem that information cannot be transmitted to the entire network when some nodes in a Bluetooth network fail or when there is environmental interference, embodiments of this application provide a Bluetooth mesh network connection method, apparatus, computer-readable storage medium, and Bluetooth communication system.

[0026] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.

[0027] The methods and embodiments provided in this application can be executed on a mobile terminal, computer terminal, or similar computing device. Taking running on a mobile terminal as an example, Figure 1 This is a hardware structure block diagram of a mobile terminal for a Bluetooth mesh network connection method according to an embodiment of the present invention. Figure 1 As shown, a mobile terminal may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. The mobile terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the mobile terminal described above. For example, the mobile terminal may also include components that are more... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.

[0028] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the device information display method in this embodiment of the invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, thereby implementing the above-described method. The memory 104 may include high-speed random access memory and non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the mobile terminal via a network. Examples of the aforementioned networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. The transmission device 106 is used to receive or send data via a network. Specific examples of the aforementioned networks may include wireless networks provided by the mobile terminal's communication provider. In one example, the transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to communicate with the Internet. In one example, the transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0029] This embodiment provides a connection method for a Bluetooth mesh network running on a mobile terminal, computer terminal, or similar computing device. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Also, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0030] Figure 2 This is a flowchart illustrating a Bluetooth mesh network connection method according to an embodiment of this application. Figure 2 As shown, the method includes the following steps:

[0031] Step S201: Broadcast first request information and receive first feedback information. The first request information is used to search for available Bluetooth devices in the vicinity. The first feedback information is used to indicate that the first target device can support Bluetooth Low Energy and mesh protocol stack. The first target device is the receiver of the Bluetooth connection.

[0032] Specifically, when the Bluetooth device, i.e., the aforementioned second target device, has a Bluetooth connection requirement, it broadcasts within the Bluetooth mesh network to search for available Bluetooth devices in the vicinity. The Bluetooth mesh network used in this application is based on the Bluetooth Low Energy communication standard. Therefore, before communication, it is necessary to determine whether the target device supports Bluetooth Low Energy and whether it supports the mesh protocol stack. Other Bluetooth devices in the Bluetooth mesh network that meet the above requirements, i.e., the first target device, will send feedback information to the second target device, instructing the second target device.

[0033] Step S202: Upon receiving the first feedback information, obtain the first identification information and send the first identification information and the first public key to the first target device. The first identification information is the unique address of the second target device, the first public key is the encryption public key of the second target device, and the second target device is the initiator of the Bluetooth connection.

[0034] Specifically, upon receiving the first feedback information, the second target device determines that the first target device corresponding to the first feedback information can communicate via the Bluetooth mesh network. It then obtains the unique address assigned to the second target device, acquires the first identification information, obtains the public key of the second target device to obtain the first public key, and broadcasts the first identification information and the first public key to the Bluetooth mesh network for sharing, thereby supporting communication encryption in subsequent communication processes.

[0035] Step S203: Upon receiving the second identification information and the second public key, a physical connection is established between the first target device and the second target device based on the second identification information, and the connection parameters of the physical connection are configured based on the second identification information and the second public key to realize data transmission between the first target device and the second target device. The second identification information includes at least the unique address of the first target device, and the second public key is the encryption public key of the first target device.

[0036] Specifically, upon receiving the first identification information, the first target device shares its unique address and public key with the Bluetooth mesh network, which constitute the second identification information and the second public key. A GATT connection can be established based on the unique addresses and public keys of both parties, enabling data transmission between them. Specifically, this involves establishing a physical intercept between the first and second target devices, followed by the second target device extracting the services and characteristics of the first target device based on its unique address, and configuring connection parameters accordingly to ensure stable and high-speed data transmission.

[0037] In this embodiment, firstly, a first request message is broadcast and a first feedback message is received. The first request message is used to search for available Bluetooth devices in the vicinity, and the first feedback message indicates that the first target device supports Bluetooth Low Energy and the mesh protocol stack. The first target device is the receiver of the Bluetooth connection. Then, if the first feedback message indicates support for Bluetooth Low Energy and the mesh protocol stack, first identification information is obtained and the first identification information and a first public key are sent to the first target device. The first identification information is the unique address of the second target device, and the first public key is the encrypted public key of the second target device. The second target device is the initiator of the Bluetooth connection. Finally, upon receiving the second identification information and the second public key, a physical connection is established with the first target device based on the second identification information, and the connection parameters of the physical connection are configured based on the second identification information and the second public key to realize data transmission between the first target device and the second target device. The second identification information includes at least the unique address of the first target device, and the second public key is the encrypted public key of the first target device. This application provides a connection method for a Bluetooth mesh network, enabling broadcast communication between devices in the Bluetooth mesh network. Any device can act as a relay node to communicate with other devices, realizing the transmission of information throughout the network. This solves the problem in the prior art where information cannot be transmitted to the entire network when some nodes fail or when there is environmental interference.

[0038] In order to establish a physical connection between the first target device and the second target device, in an optional implementation, step S203 includes:

[0039] Step S2031: Upon receiving the second identification information, encrypt the first authentication information using the second public key to obtain a first broadcast packet and send the first broadcast packet to the first target device.

[0040] Specifically, when the first target device receives the unique address of the second target device, it encrypts the authentication information of the first target device using the public key of the second target device to obtain the first broadcast packet, and broadcasts the first broadcast packet to the first target device through the Bluetooth mesh network.

[0041] Step S2032: Upon receiving the second broadcast packet, the second broadcast packet is decrypted using the second private key to obtain second feedback information. The second broadcast packet is a broadcast packet sent from the first target device to the second target device. The second feedback information includes whether the first target device has successfully authenticated and second authentication information. The second private key is the private key corresponding to the second public key.

[0042] Specifically, upon receiving the first broadcast packet, the first target device decrypts the first broadcast packet using the second private key corresponding to the second public key, and performs authentication based on the first authentication information. Then, it encrypts the authentication result and the first target device's authentication information (i.e., the second authentication information) using the first public key to obtain a second broadcast packet, which is then sent to the second target device. The second target device decrypts the second broadcast packet using the second private key corresponding to the first target device's second public key to obtain the second feedback information.

[0043] Step S2033: Extract data from the second feedback information to obtain the second authentication information, perform authentication based on the second authentication information, and if the authentication is successful, initiate a pairing request to the first target device based on the second identification information.

[0044] Specifically, the second target device performs authentication based on the second authentication information corresponding to the first target device, and if the authentication is successful, initiates pairing with the first target device to ensure that the device being connected is an authorized device, thereby preventing unauthorized devices from connecting.

[0045] Step S2034: If the pairing request is approved, establish a physical connection with the first target device.

[0046] Specifically, when the first target device and the second target device are successfully paired, a data transmission connection is established based on the unique address of the first target device and the unique address of the second target device, that is, the aforementioned physical connection is established.

[0047] To achieve efficient and stable data transmission between the first target device and the second target device, in one optional implementation, step S203 includes:

[0048] Step S2035: When the physical connection between the second target device and the first target device is successfully established, the target protocol is obtained by reading the mesh protocol stack according to the second identification information and the target interface is determined according to the target protocol. The target protocol is the GATT protocol and the target interface is the API interface corresponding to the target protocol.

[0049] Specifically, when the second target device and the first target device successfully establish a physical connection, the mesh protocol stack is read according to the unique address corresponding to the first target device, the GATT protocol matching the first target device is determined to obtain the target protocol, and the API interface that can be applied to GATT protocol data transmission is determined to obtain the target interface.

[0050] Step S2036: Send a second request message to the first target device through the target interface and receive a third feedback message. The second request message is used to obtain the attribute table of the first target device. The third feedback message includes the attribute table. The attribute table is used to store the Bluetooth services and service features provided by the first target device.

[0051] Specifically, the second target device initiates the second request to the first target device through the target interface to begin the service discovery process, in order to find the services and features provided by the first target device. Specifically, this involves obtaining the attribute table of the first target device, which lists all available services and features of the first target device, namely the Bluetooth service and one or more corresponding service features.

[0052] Step S2037: Based on the third feedback information, determine multiple first durations and multiple second durations. The first duration is the interval duration of data interaction when the first target device implements the Bluetooth service for the second target device. The second duration is the maximum connection duration of data interaction when the first target device implements the Bluetooth service for the second target device. The first duration corresponds one-to-one with the second duration and the Bluetooth service.

[0053] Specifically, based on the services and characteristics in the attribute table above, the second target device negotiates connection parameters with the first target device, including the connection interval, i.e. the first duration, and the timeout period, i.e. the second duration.

[0054] Step S2038: Configure the connection parameters according to the first duration and the second duration.

[0055] Specifically, with the connection parameters determined, the parameter configuration of the first target device and the second target device is completed according to the first duration and the second duration.

[0056] To complete the above connection parameter configuration, in one optional implementation, step S2038 includes:

[0057] Step S20381: Determine the target service based on the first duration and the second duration, and obtain the first target value by capturing the characteristic value of the target characteristic corresponding to the target service through the target interface;

[0058] Specifically, the first duration and the second duration mentioned above correspond one-to-one with the corresponding services. Based on the configuration parameters of the corresponding services, the required API interface, i.e., the target interface mentioned above, is determined. The first target value is obtained by capturing the characteristic value of the corresponding target characteristic in the first target device through the target interface. This specifically includes the characteristic value, descriptor, and permissions.

[0059] Step S20382: Update the first target value according to the first duration and the second duration to obtain the second target value, and send the second target value to the first target device.

[0060] Specifically, the updated feature values, descriptors, and permissions are determined based on the first and second durations mentioned above, and then the updated parameters are written into the corresponding location of the first target device to complete the configuration of the connection parameters.

[0061] In order to transmit data from the second target device to the first target device, in an optional embodiment, after data transmission between the first target device and the second target device is achieved, the method further includes:

[0062] Step S301: When the second target device has a data transmission request, obtain the second identification information and the target operation code. The target operation code is used to characterize the message type that the second target device plans to send and the operation performed by the second target device on the first target device.

[0063] Specifically, when the second target device needs to transmit data, the second target device determines the unique address of the first target device and the target operation code and other necessary parameters generated by the operation to be performed on the first target device based on the protocol rules of the mesh network.

[0064] Step S302: Construct a data packet based on the second identification information and the target opcode to obtain a target data packet, and encrypt the target data packet based on the AES symmetric encryption algorithm to obtain a third broadcast packet;

[0065] Specifically, the target data packet is constructed based on the unique address, the target opcode, and the corresponding necessary parameters to obtain the message to be sent. Then, the target data packet is encrypted using the AES symmetric encryption algorithm to obtain the third broadcast packet.

[0066] Step S303: Broadcast the third broadcast packet via Bluetooth mesh network;

[0067] Specifically, the third broadcast packet is broadcast to the first target device via a Bluetooth mesh network.

[0068] In step S304, if the fourth feedback information is received within a preset time period, it is determined that the data transmission was successful. The fourth feedback information is used to indicate that the first target device successfully received the third broadcast packet.

[0069] Specifically, when the first target device receives the third broadcast packet, it will send the fourth feedback information to the second target device via the Bluetooth mesh network.

[0070] To ensure the security and integrity of data during transmission, in one optional implementation, step S302 includes:

[0071] Step S3021: Obtain the message authentication code by performing a cryptographic hash function based on the target data packet and the second public key.

[0072] Specifically, to ensure information security, this application encrypts the information before transmission. First, the information is encoded. Then, the encoded information and the aforementioned second formula corresponding to the first target device are processed using a cryptographic hash function or block cipher algorithm to generate a message authentication code, i.e., a MAC value.

[0073] Step S3022: The message authentication code and the target data packet are encrypted using the second public key to obtain the third broadcast packet.

[0074] Specifically, the message verification code is attached to the message and encrypted together to obtain the aforementioned third broadcast packet. When the first target device receives the third broadcast packet, it decrypts it. Then, based on the decrypted message and the key, the MAC value is recalculated. If the received MAC value matches the calculated MAC value, the data packet is considered intact.

[0075] To avoid data transmission failures due to complex environments and distance, in an optional implementation, after broadcasting the third broadcast packet via a Bluetooth mesh network, the method further includes:

[0076] Step S401: If the fourth feedback information is not received within a preset time period, the fifth feedback information is obtained. The fifth feedback information is used to indicate that the relay node has successfully received the third broadcast packet.

[0077] Specifically, if the second target device does not receive the fourth feedback information from the first target device within a preset time period, it determines that the data transmission has failed, and then obtains the fifth feedback information from the relay node involved in the transmission process to determine the data transmission status of the third broadcast packet in the Bluetooth mesh network.

[0078] Step S402: Determine the third target device and the fourth target device based on the fifth feedback information. The third target device is the device corresponding to the relay node of the fifth feedback information with the shortest interval from the current time during the data transmission process. The fourth target device is the device corresponding to the previous relay node of the relay node corresponding to the first target device.

[0079] Specifically, the hopping order of the third broadcast packet in the Bluetooth mesh network is determined based on the reception time of the fifth feedback information, thereby determining the last relay node passed through during data transmission, namely the third target device, and the previous relay node of the third target device, namely the fourth target device.

[0080] Step S403: Send a third request message to the fourth target device. The third request message is used to instruct the fourth target device to broadcast the third broadcast packet to devices in the Bluetooth mesh network other than the third target device.

[0081] Specifically, after determining the third target device and the fourth target device, it is determined that the third target device is temporarily unable to complete data transmission. Then, the second target device sends the third request information to the fourth target device, thereby controlling the fourth target device to select other paths to jump to achieve data transmission.

[0082] To enable those skilled in the art to better understand the technical solution of this application, the implementation process of the Bluetooth mesh network connection method of this application will be described in detail below with reference to specific embodiments.

[0083] This embodiment relates to a specific method for connecting a Bluetooth mesh network, such as... Figure 3 As shown, it includes the following steps:

[0084] Step S1: Search for the device name of a Bluetooth device using the Bluetooth search function and generate a list of available devices in the mini-program;

[0085] Step S2: Select the target Bluetooth device from the list of available devices, and initiate a connection request to the target Bluetooth device to establish a GATT connection with the target Bluetooth device;

[0086] Step S3: After establishing a GATT connection, send a device information acquisition request to the target Bluetooth device through the mini-program to discover the services and features of the target Bluetooth device;

[0087] Step S4: Based on services and features, negotiate connection parameters and establish a data transmission connection between the target Bluetooth device and the mini-program;

[0088] Step S5: When a device is connected, data transmission between the mini-program and the target Bluetooth device needs to be encrypted to ensure information security.

[0089] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.

[0090] This application also provides a Bluetooth mesh network connection device. It should be noted that the Bluetooth mesh network connection device of this application can be used to execute the Bluetooth mesh network connection method provided in this application. This device is used to implement the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0091] The following describes the Bluetooth mesh network connection device provided in the embodiments of this application.

[0092] Figure 4 This is a structural block diagram of a Bluetooth mesh network connection device according to an embodiment of this application. Figure 4As shown, the device includes:

[0093] The first receiving unit 10 is used to broadcast a first request information and receive a first feedback information. The first request information is used to search for available Bluetooth devices in the vicinity. The first feedback information is used to indicate that the first target device can support Bluetooth Low Energy and mesh protocol stack. The first target device is the receiver of the Bluetooth connection.

[0094] Specifically, when the Bluetooth device, i.e., the aforementioned second target device, has a Bluetooth connection requirement, it broadcasts within the Bluetooth mesh network to search for available Bluetooth devices in the vicinity. The Bluetooth mesh network used in this application is based on the Bluetooth Low Energy communication standard. Therefore, before communication, it is necessary to determine whether the target device supports Bluetooth Low Energy and whether it supports the mesh protocol stack. Other Bluetooth devices in the Bluetooth mesh network that meet the above requirements, i.e., the first target device, will send feedback information to the second target device, instructing the second target device.

[0095] The first sending unit 20 is configured to, when the first feedback information indicates support for the Bluetooth Low Energy function and the mesh protocol stack, obtain first identification information and send the first identification information and the first public key to the first target device. The first identification information is the unique address of the second target device, the first public key is the encryption public key of the second target device, and the second target device is the initiator of the Bluetooth connection.

[0096] Specifically, upon receiving the first feedback information, the second target device determines that the first target device corresponding to the first feedback information can communicate via the Bluetooth mesh network. It then obtains the unique address assigned to the second target device, acquires the first identification information, obtains the public key of the second target device to obtain the first public key, and broadcasts the first identification information and the first public key to the Bluetooth mesh network for sharing, thereby supporting communication encryption in subsequent communication processes.

[0097] The configuration unit 30 is configured to, upon receiving the second identification information and the second public key, establish a physical connection with the first target device based on the second identification information, and configure the connection parameters of the physical connection based on the second identification information and the second public key to realize data transmission between the first target device and the second target device. The second identification information includes at least the unique address of the first target device, and the second public key is the encryption public key of the first target device.

[0098] Specifically, upon receiving the first identification information, the first target device shares its unique address and public key with the Bluetooth mesh network, which constitute the second identification information and the second public key. A GATT connection can be established based on the unique addresses and public keys of both parties, enabling data transmission between them. Specifically, this involves establishing a physical intercept between the first and second target devices, followed by the second target device extracting the services and characteristics of the first target device based on its unique address, and configuring connection parameters accordingly to ensure stable and high-speed data transmission.

[0099] In this embodiment, the first receiving unit broadcasts a first request message and receives a first feedback message. The first request message is used to search for available Bluetooth devices in the vicinity, and the first feedback message indicates that the first target device supports Bluetooth Low Energy and the mesh protocol stack. The first target device is the receiver of the Bluetooth connection. When the first feedback message indicates support for Bluetooth Low Energy and the mesh protocol stack, the first sending unit obtains first identification information and sends the first identification information and a first public key to the first target device. The first identification information is the unique address of the second target device, and the first public key is the encrypted public key of the second target device. The second target device is the initiator of the Bluetooth connection. When the configuration unit receives the second identification information and the second public key, it establishes a physical connection with the first target device based on the second identification information and configures the connection parameters of the physical connection based on the second identification information and the second public key to realize data transmission between the first target device and the second target device. The second identification information includes at least the unique address of the first target device, and the second public key is the encrypted public key of the first target device. This application provides a connection method for a Bluetooth mesh network, enabling broadcast communication between devices in the Bluetooth mesh network. Any device can act as a relay node to communicate with other devices, realizing the transmission of information throughout the network. This solves the problem in the prior art where information cannot be transmitted to the entire network when some nodes fail or when there is environmental interference.

[0100] In order to establish a physical connection between the first target device and the second target device, in an optional embodiment, the configuration unit includes:

[0101] The first encryption module is used to, upon receiving the second identification information, encrypt the first authentication information according to the second public key to obtain a first broadcast packet and send the first broadcast packet to the first target device.

[0102] Specifically, when the first target device receives the unique address of the second target device, it encrypts the authentication information of the first target device using the public key of the second target device to obtain the first broadcast packet, and broadcasts the first broadcast packet to the first target device through the Bluetooth mesh network.

[0103] The decryption module is used to decrypt the second broadcast packet according to the second private key to obtain the second feedback information when the second broadcast packet is received. The second broadcast packet is a broadcast packet sent from the first target device to the second target device. The second feedback information includes whether the first target device has successfully authenticated and the second authentication information. The second private key is the private key corresponding to the second public key.

[0104] Specifically, upon receiving the first broadcast packet, the first target device decrypts the first broadcast packet using the second private key corresponding to the second public key, and performs authentication based on the first authentication information. Then, it encrypts the authentication result and the first target device's authentication information (i.e., the second authentication information) using the first public key to obtain a second broadcast packet, which is then sent to the second target device. The second target device decrypts the second broadcast packet using the second private key corresponding to the first target device's second public key to obtain the second feedback information.

[0105] The first capture module is used to extract data from the second feedback information to obtain the second authentication information, perform authentication based on the second authentication information, and, if the authentication is successful, initiate a pairing request to the first target device based on the second identification information.

[0106] Specifically, the second target device performs authentication based on the second authentication information corresponding to the first target device, and if the authentication is successful, initiates pairing with the first target device to ensure that the device being connected is an authorized device, thereby preventing unauthorized devices from connecting.

[0107] The connection module is used to establish a physical connection with the first target device mentioned above when the pairing request is approved.

[0108] Specifically, when the first target device and the second target device are successfully paired, a data transmission connection is established based on the unique address of the first target device and the unique address of the second target device, that is, the aforementioned physical connection is established.

[0109] To achieve efficient and stable data transmission between the first target device and the second target device, in one optional implementation, the configuration unit includes:

[0110] The first determining module is used to, when the physical connection between the second target device and the first target device is successfully established, read the mesh protocol stack according to the second identification information to obtain the target protocol and determine the target interface according to the target protocol. The target protocol is the GATT protocol and the target interface is the API interface corresponding to the target protocol.

[0111] Specifically, when the second target device and the first target device successfully establish a physical connection, the mesh protocol stack is read according to the unique address corresponding to the first target device, the GATT protocol matching the first target device is determined to obtain the target protocol, and the API interface that can be applied to GATT protocol data transmission is determined to obtain the target interface.

[0112] The sending module is used to send a second request message to the first target device through the target interface and receive a third feedback message. The second request message is used to obtain the attribute table of the first target device. The third feedback message includes the attribute table. The attribute table is used to store the Bluetooth service and service features provided by the first target device.

[0113] Specifically, the second target device initiates the second request to the first target device through the target interface to begin the service discovery process, in order to find the services and features provided by the first target device. Specifically, this involves obtaining the attribute table of the first target device, which lists all available services and features of the first target device, namely the Bluetooth service and one or more corresponding service features.

[0114] The second determining module is used to determine multiple first durations and multiple second durations based on the third feedback information. The first duration is the interval duration of data interaction when the first target device implements the Bluetooth service for the second target device. The second duration is the maximum connection duration of data interaction when the first target device implements the Bluetooth service for the second target device. The first duration corresponds one-to-one with the second duration and the Bluetooth service.

[0115] Specifically, based on the services and characteristics in the attribute table above, the second target device negotiates connection parameters with the first target device, including the connection interval, i.e. the first duration, and the timeout period, i.e. the second duration.

[0116] The configuration module is used to configure the connection parameters according to the first duration and the second duration.

[0117] Specifically, with the connection parameters determined, the parameter configuration of the first target device and the second target device is completed according to the first duration and the second duration.

[0118] To complete the above connection parameter configuration, in one optional implementation, the configuration module includes:

[0119] The determination submodule is used to determine the target service based on the first duration and the second duration, and obtain the first target value by capturing the characteristic value of the target characteristic corresponding to the target service through the target interface.

[0120] Specifically, the first duration and the second duration mentioned above correspond one-to-one with the corresponding services. Based on the configuration parameters of the corresponding services, the required API interface, i.e., the target interface mentioned above, is determined. The first target value is obtained by capturing the characteristic value of the corresponding target characteristic in the first target device through the target interface. This specifically includes the characteristic value, descriptor, and permissions.

[0121] The update submodule is used to update the first target value according to the first duration and the second duration to obtain the second target value, and send the second target value to the first target device.

[0122] Specifically, the updated feature values, descriptors, and permissions are determined based on the first and second durations mentioned above, and then the updated parameters are written into the corresponding location of the first target device to complete the configuration of the connection parameters.

[0123] To enable data transmission from the second target device to the first target device, the apparatus further includes:

[0124] The first acquisition unit is configured, in an optional embodiment, after data transmission between the first target device and the second target device is completed, to acquire second identification information and a target operation code when the second target device has a data transmission request. The target operation code is used to characterize the message type that the second target device plans to send and the operation performed by the second target device on the first target device.

[0125] Specifically, when the second target device needs to transmit data, the second target device determines the unique address of the first target device and the target operation code and other necessary parameters generated by the operation to be performed on the first target device based on the protocol rules of the mesh network.

[0126] The encryption unit is used to construct a data packet based on the second identification information and the target opcode to obtain a target data packet, and to encrypt the target data packet based on the AES symmetric encryption algorithm to obtain a third broadcast packet.

[0127] Specifically, the target data packet is constructed based on the unique address, the target opcode, and the corresponding necessary parameters to obtain the message to be sent. Then, the target data packet is encrypted using the AES symmetric encryption algorithm to obtain the third broadcast packet.

[0128] The second transmitting unit is used to broadcast the aforementioned third broadcast packet via a Bluetooth mesh network;

[0129] Specifically, the third broadcast packet is broadcast to the first target device via a Bluetooth mesh network.

[0130] The second receiving unit is used to determine that the data transmission was successful if it receives the fourth feedback information within a preset time period. The fourth feedback information is used to indicate that the first target device successfully received the third broadcast packet.

[0131] Specifically, when the first target device receives the third broadcast packet, it will send the fourth feedback information to the second target device via the Bluetooth mesh network.

[0132] To ensure the security and integrity of data during transmission, in one optional implementation, the second receiving unit includes:

[0133] The calculation module is used to obtain the message authentication code by performing a cryptographic hash function based on the target data packet and the second public key.

[0134] Specifically, to ensure information security, this application encrypts the information before transmission. First, the information is encoded. Then, the encoded information and the aforementioned second formula corresponding to the first target device are processed using a cryptographic hash function or block cipher algorithm to generate a message authentication code, i.e., a MAC value.

[0135] The second encryption module is used to encrypt the message authentication code and the target data packet using the second public key to obtain the third broadcast packet.

[0136] Specifically, the message verification code is attached to the message and encrypted together to obtain the aforementioned third broadcast packet. When the first target device receives the third broadcast packet, it decrypts it. Then, based on the decrypted message and the key, the MAC value is recalculated. If the received MAC value matches the calculated MAC value, the data packet is considered intact.

[0137] To avoid data transmission failures due to complex environments and distance, in one optional embodiment, the above-mentioned device further includes:

[0138] The second acquisition unit is used to acquire fifth feedback information if no fourth feedback information is received within a preset time after the third broadcast packet is broadcast via the Bluetooth mesh network. The fifth feedback information is used to indicate that the relay node has successfully received the third broadcast packet.

[0139] Specifically, if the second target device does not receive the fourth feedback information from the first target device within a preset time period, it determines that the data transmission has failed, and then obtains the fifth feedback information from the relay node involved in the transmission process to determine the data transmission status of the third broadcast packet in the Bluetooth mesh network.

[0140] The determining unit is used to determine the third target device and the fourth target device based on the fifth feedback information mentioned above. The third target device is the device corresponding to the relay node of the fifth feedback information with the shortest interval from the current time during the data transmission process. The fourth target device is the device corresponding to the previous relay node of the relay node corresponding to the first target device.

[0141] Specifically, the hopping order of the third broadcast packet in the Bluetooth mesh network is determined based on the reception time of the fifth feedback information, thereby determining the last relay node passed through during data transmission, namely the third target device, and the previous relay node of the third target device, namely the fourth target device.

[0142] The third sending unit is used to send a third request message to the fourth target device, the third request message being used to instruct the fourth target device to broadcast the third broadcast packet to devices in the Bluetooth mesh network other than the third target device.

[0143] Specifically, after determining the third target device and the fourth target device, it is determined that the third target device is temporarily unable to complete data transmission. Then, the second target device sends the third request information to the fourth target device, thereby controlling the fourth target device to select other paths to jump to achieve data transmission.

[0144] The aforementioned Bluetooth mesh network connection device includes a processor and a memory. The first receiving unit, the first transmitting unit, and the configuration unit are all stored as program units in the memory, and the processor executes these program units stored in the memory to implement their respective functions. All of the above modules reside in the same processor; alternatively, the modules may be located in different processors in any combination.

[0145] A processor contains a kernel, which retrieves the corresponding program unit from memory. One or more kernels can be configured, and their parameters can be adjusted to ensure data transmission over long distances and in complex environments.

[0146] The memory may include non-permanent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.

[0147] This invention provides a computer-readable storage medium including a stored program, wherein, when the program is executed, it controls the device containing the computer-readable storage medium to perform the Bluetooth mesh network connection method.

[0148] Specifically, the connection methods for Bluetooth mesh networks include:

[0149] Step S201: Broadcast first request information and receive first feedback information. The first request information is used to search for available Bluetooth devices in the vicinity. The first feedback information is used to indicate that the first target device can support Bluetooth Low Energy and mesh protocol stack. The first target device is the receiver of the Bluetooth connection.

[0150] Specifically, when the Bluetooth device, i.e., the aforementioned second target device, has a Bluetooth connection requirement, it broadcasts within the Bluetooth mesh network to search for available Bluetooth devices in the vicinity. The Bluetooth mesh network used in this application is based on the Bluetooth Low Energy communication standard. Therefore, before communication, it is necessary to determine whether the target device supports Bluetooth Low Energy and whether it supports the mesh protocol stack. Other Bluetooth devices in the Bluetooth mesh network that meet the above requirements, i.e., the first target device, will send feedback information to the second target device, instructing the second target device.

[0151] Step S202: Upon receiving the first feedback information, obtain the first identification information and send the first identification information and the first public key to the first target device. The first identification information is the unique address of the second target device, the first public key is the encryption public key of the second target device, and the second target device is the initiator of the Bluetooth connection.

[0152] Specifically, upon receiving the first feedback information, the second target device determines that the first target device corresponding to the first feedback information can communicate via the Bluetooth mesh network. It then obtains the unique address assigned to the second target device, acquires the first identification information, obtains the public key of the second target device to obtain the first public key, and broadcasts the first identification information and the first public key to the Bluetooth mesh network for sharing, thereby supporting communication encryption in subsequent communication processes.

[0153] Step S203: Upon receiving the second identification information and the second public key, a physical connection is established between the first target device and the second target device based on the second identification information, and the connection parameters of the physical connection are configured based on the second identification information and the second public key to realize data transmission between the first target device and the second target device. The second identification information includes at least the unique address of the first target device, and the second public key is the encryption public key of the first target device.

[0154] Specifically, upon receiving the first identification information, the first target device shares its unique address and public key with the Bluetooth mesh network, which constitute the second identification information and the second public key. A GATT connection can be established based on the unique addresses and public keys of both parties, enabling data transmission between them. Specifically, this involves establishing a physical intercept between the first and second target devices, followed by the second target device extracting the services and characteristics of the first target device based on its unique address, and configuring connection parameters accordingly to ensure stable and high-speed data transmission.

[0155] This invention provides a processor for running a program, wherein the program executes the Bluetooth mesh network connection method during runtime.

[0156] Specifically, the connection methods for Bluetooth mesh networks include:

[0157] Step S201: Broadcast first request information and receive first feedback information. The first request information is used to search for available Bluetooth devices in the vicinity. The first feedback information is used to indicate that the first target device can support Bluetooth Low Energy and mesh protocol stack. The first target device is the receiver of the Bluetooth connection.

[0158] Specifically, when the Bluetooth device, i.e., the aforementioned second target device, has a Bluetooth connection requirement, it broadcasts within the Bluetooth mesh network to search for available Bluetooth devices in the vicinity. The Bluetooth mesh network used in this application is based on the Bluetooth Low Energy communication standard. Therefore, before communication, it is necessary to determine whether the target device supports Bluetooth Low Energy and whether it supports the mesh protocol stack. Other Bluetooth devices in the Bluetooth mesh network that meet the above requirements, i.e., the first target device, will send feedback information to the second target device, instructing the second target device.

[0159] Step S202: Upon receiving the first feedback information, obtain the first identification information and send the first identification information and the first public key to the first target device. The first identification information is the unique address of the second target device, the first public key is the encryption public key of the second target device, and the second target device is the initiator of the Bluetooth connection.

[0160] Specifically, upon receiving the first feedback information, the second target device determines that the first target device corresponding to the first feedback information can communicate via the Bluetooth mesh network. It then obtains the unique address assigned to the second target device, acquires the first identification information, obtains the public key of the second target device to obtain the first public key, and broadcasts the first identification information and the first public key to the Bluetooth mesh network for sharing, thereby supporting communication encryption in subsequent communication processes.

[0161] Step S203: Upon receiving the second identification information and the second public key, a physical connection is established between the first target device and the second target device based on the second identification information, and the connection parameters of the physical connection are configured based on the second identification information and the second public key to realize data transmission between the first target device and the second target device. The second identification information includes at least the unique address of the first target device, and the second public key is the encryption public key of the first target device.

[0162] Specifically, upon receiving the first identification information, the first target device shares its unique address and public key with the Bluetooth mesh network, which constitute the second identification information and the second public key. A GATT connection can be established based on the unique addresses and public keys of both parties, enabling data transmission between them. Specifically, this involves establishing a physical intercept between the first and second target devices, followed by the second target device extracting the services and characteristics of the first target device based on its unique address, and configuring connection parameters accordingly to ensure stable and high-speed data transmission.

[0163] This invention provides a Bluetooth communication system, which includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, it performs at least the following steps:

[0164] Step S201: Broadcast first request information and receive first feedback information. The first request information is used to search for available Bluetooth devices in the vicinity. The first feedback information is used to indicate that the first target device can support Bluetooth Low Energy and mesh protocol stack. The first target device is the receiver of the Bluetooth connection.

[0165] Step S202: Upon receiving the first feedback information, obtain the first identification information and send the first identification information and the first public key to the first target device. The first identification information is the unique address of the second target device, the first public key is the encryption public key of the second target device, and the second target device is the initiator of the Bluetooth connection.

[0166] Step S203: Upon receiving the second identification information and the second public key, a physical connection is established between the first target device and the second target device based on the second identification information, and the connection parameters of the physical connection are configured based on the second identification information and the second public key to realize data transmission between the first target device and the second target device. The second identification information includes at least the unique address of the first target device, and the second public key is the encryption public key of the first target device.

[0167] This application also provides a computer program product, which, when executed on a data processing device, is suitable for executing an initialization program having at least the following method steps:

[0168] Step S201: Broadcast first request information and receive first feedback information. The first request information is used to search for available Bluetooth devices in the vicinity. The first feedback information is used to indicate that the first target device can support Bluetooth Low Energy and mesh protocol stack. The first target device is the receiver of the Bluetooth connection.

[0169] Step S202: Upon receiving the first feedback information, obtain the first identification information and send the first identification information and the first public key to the first target device. The first identification information is the unique address of the second target device, the first public key is the encryption public key of the second target device, and the second target device is the initiator of the Bluetooth connection.

[0170] Step S203: Upon receiving the second identification information and the second public key, a physical connection is established between the first target device and the second target device based on the second identification information, and the connection parameters of the physical connection are configured based on the second identification information and the second public key to realize data transmission between the first target device and the second target device. The second identification information includes at least the unique address of the first target device, and the second public key is the encryption public key of the first target device.

[0171] It is obvious to those skilled in the art that the modules or steps of the present invention described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those described herein, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.

[0172] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0173] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0174] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0175] These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable apparatus for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0176] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0177] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0178] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0179] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0180] As can be seen from the above description, the embodiments of this application achieve the following technical effects:

[0181] 1) The Bluetooth mesh network connection method of this application firstly broadcasts a first request message and receives a first feedback message. The first request message is used to search for available Bluetooth devices in the vicinity, and the first feedback message is used to indicate that a first target device can support Bluetooth Low Energy and the mesh protocol stack. The first target device is the receiver of the Bluetooth connection. Then, if the first feedback message indicates that the device supports Bluetooth Low Energy and the mesh protocol stack, a first identification message is obtained and the first identification message and a first public key are sent to the first target device. The first identification message is the unique address of the second target device, and the first public key is the encrypted public key of the second target device. The second target device is the initiator of the Bluetooth connection. Finally, upon receiving the second identification message and the second public key, a physical connection is established with the first target device based on the second identification message, and the connection parameters of the physical connection are configured based on the second identification message and the second public key to realize data transmission between the first target device and the second target device. The second identification message includes at least the unique address of the first target device, and the second public key is the encrypted public key of the first target device. This application provides a connection method for a Bluetooth mesh network, enabling broadcast communication between devices in the Bluetooth mesh network. Any device can act as a relay node to communicate with other devices, realizing the transmission of information throughout the network. This solves the problem in the prior art where information cannot be transmitted to the entire network when some nodes fail or when there is environmental interference.

[0182] 2) The Bluetooth mesh network connection device of this application includes a first receiving unit that broadcasts first request information and receives first feedback information. The first request information is used to search for available Bluetooth devices in the vicinity, and the first feedback information is used to indicate that a first target device can support Bluetooth Low Energy and the mesh protocol stack. The first target device is the receiver of the Bluetooth connection. When the first feedback information indicates that the device supports Bluetooth Low Energy and the mesh protocol stack, the first sending unit obtains first identification information and sends the first identification information and a first public key to the first target device. The first identification information is the unique address of the second target device, and the first public key is the encrypted public key of the second target device. The second target device is the initiator of the Bluetooth connection. When the configuration unit receives the second identification information and the second public key, it establishes a physical connection with the first target device based on the second identification information and configures the connection parameters of the physical connection based on the second identification information and the second public key to realize data transmission between the first target device and the second target device. The second identification information includes at least the unique address of the first target device, and the second public key is the encrypted public key of the first target device. This application provides a connection method for a Bluetooth mesh network, enabling broadcast communication between devices in the Bluetooth mesh network. Any device can act as a relay node to communicate with other devices, realizing the transmission of information throughout the network. This solves the problem in the prior art where information cannot be transmitted to the entire network when some nodes fail or when there is environmental interference.

[0183] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.

Claims

1. A connection method of a Bluetooth mesh network, characterized by, include: Broadcast a first request message and receive a first feedback message. The first request message is used to search for available Bluetooth devices in the vicinity. The first feedback message is used to indicate that the first target device can support Bluetooth Low Energy and mesh protocol stack. The first target device is the receiver of the Bluetooth connection. Upon receiving the first feedback information, the system obtains the first identification information and sends the first identification information and the first public key to the first target device. The first identification information is the unique address of the second target device, and the first public key is the encryption public key of the second target device. The second target device is the initiator of the Bluetooth connection. Upon receiving the second identification information and the second public key, a physical connection is established with the first target device based on the second identification information, and the connection parameters of the physical connection are configured based on the second identification information and the second public key to realize data transmission between the first target device and the second target device. The second identification information includes at least the unique address of the first target device, and the second public key is the encryption public key of the first target device. After data transmission between the first target device and the second target device is achieved, the method further includes: When the second target device has a data transmission request, the second identification information and the target operation code are obtained. The target operation code is used to characterize the message type that the second target device plans to send and the operation that the second target device performs on the first target device. The target data packet is obtained by constructing a data packet based on the second identification information and the target opcode, and the target data packet is encrypted based on the AES symmetric encryption algorithm to obtain the third broadcast packet; The third broadcast packet is broadcast via a Bluetooth mesh network; If the fourth feedback information is received within a preset time period, it is determined that the data transmission was successful. The fourth feedback information is used to indicate that the first target device successfully received the third broadcast packet. After broadcasting the third broadcast packet via a Bluetooth mesh network, the method further includes: If no fourth feedback information is received within a preset time period, a fifth feedback information is obtained. The fifth feedback information is used to indicate that the relay node has successfully received the third broadcast packet. The third target device and the fourth target device are determined based on the fifth feedback information. The third target device is the device corresponding to the relay node of the fifth feedback information with the shortest interval from the current time during the data transmission process. The fourth target device is the device corresponding to the previous relay node of the relay node corresponding to the first target device. Send a third request message to the fourth target device, the third request message being used to instruct the fourth target device to broadcast the third broadcast packet to devices in the Bluetooth mesh network other than the third target device; The target data packet is encrypted using the AES symmetric encryption algorithm to obtain a third broadcast packet, which includes: The message authentication code is obtained by performing a cryptographic hash function on the target data packet and the second public key; The third broadcast packet is obtained by encrypting the message authentication code and the target data packet using the second public key.

2. The method of claim 1, wherein, Establishing a physical connection with the first target device based on the second identification information includes: Upon receiving the second identification information, the first authentication information is encrypted using the second public key to obtain a first broadcast packet, and the first broadcast packet is sent to the first target device. Upon receiving the second broadcast packet, the second broadcast packet is decrypted using the second private key to obtain the second feedback information. The second broadcast packet is a broadcast packet sent from the first target device to the second target device. The second feedback information includes whether the first target device has successfully authenticated and the second authentication information. The second private key is the private key corresponding to the second public key. The second authentication information is obtained by extracting data from the second feedback information. Authentication is performed based on the second authentication information. If the authentication is successful, a pairing request is initiated to the first target device based on the second identification information. If the pairing request is approved, a physical connection is established with the first target device.

3. The method of claim 2, wherein, Data transmission between the first target device and the second target device is implemented by configuring the connection parameters of the physical connection according to the second identification information and the second public key, including: When the physical connection between the second target device and the first target device is successfully established, the target protocol is obtained by reading the mesh protocol stack according to the second identification information and the target interface is determined according to the target protocol. The target protocol is the GATT protocol and the target interface is the API interface corresponding to the target protocol. The target interface sends a second request message to the first target device and receives a third feedback message. The second request message is used to obtain the attribute table of the first target device. The third feedback message includes the attribute table. The attribute table is used to store the Bluetooth services and service features provided by the first target device. Based on the third feedback information, multiple first durations and multiple second durations are determined. The first duration is the interval duration of data interaction when the first target device implements the Bluetooth service for the second target device. The second duration is the maximum connection duration of data interaction when the first target device implements the Bluetooth service for the second target device. The first duration, the second duration, and the Bluetooth service correspond one-to-one. Configure the connection parameters according to the first duration and the second duration.

4. The method of claim 3, wherein, Configure the connection parameters according to the first duration and the second duration, including: The target service is determined based on the first duration and the second duration, and the first target value is obtained by capturing the characteristic value of the target characteristic corresponding to the target service through the target interface. The first target value is updated according to the first duration and the second duration to obtain the second target value, and the second target value is sent to the first target device.

5. A Bluetooth mesh network connection device, characterized in that, The device includes: The first receiving unit is used to broadcast a first request message and receive a first feedback message. The first request message is used to search for available Bluetooth devices in the vicinity. The first feedback message is used to indicate that the first target device can support Bluetooth Low Energy and mesh protocol stack. The first target device is a receiver connected via Bluetooth. The first sending unit is configured to obtain first identification information and send the first identification information and the first public key to the first target device when the first feedback information supports the Bluetooth Low Energy function and the mesh protocol stack. The first identification information is the unique address of the second target device, the first public key is the encryption public key of the second target device, and the second target device is the initiator of the Bluetooth connection. A configuration unit is configured to, upon receiving second identification information and a second public key, establish a physical connection with the first target device based on the second identification information, and configure the connection parameters of the physical connection based on the second identification information and the second public key to realize data transmission between the first target device and the second target device. The second identification information includes at least the unique address of the first target device, and the second public key is the encryption public key of the first target device. The device further includes: The first acquisition unit is configured to acquire second identification information and a target operation code when the second target device has a data transmission request after the data transmission between the first target device and the second target device is completed. The target operation code is used to characterize the message type that the second target device plans to send and the operation performed by the second target device on the first target device. An encryption unit is used to construct a data packet based on the second identification information and the target opcode to obtain a target data packet, and to encrypt the target data packet based on the AES symmetric encryption algorithm to obtain a third broadcast packet; The second transmitting unit is used to broadcast the third broadcast packet via a Bluetooth mesh network; The second receiving unit is used to determine that the data transmission is successful when it receives the fourth feedback information within a preset time period. The fourth feedback information is used to indicate that the first target device has successfully received the third broadcast packet. The device further includes: The second acquisition unit is used to acquire fifth feedback information if no fourth feedback information is received within a preset time after the third broadcast packet is broadcast through the Bluetooth mesh network. The fifth feedback information is used to indicate that the relay node has successfully received the third broadcast packet. The determining unit is used to determine a third target device and a fourth target device based on the fifth feedback information. The third target device is the device corresponding to the relay node of the fifth feedback information with the shortest interval from the current time during the data transmission process. The fourth target device is the device corresponding to the previous relay node of the relay node corresponding to the first target device. The third sending unit is configured to send a third request information to the fourth target device, the third request information being configured to instruct the fourth target device to broadcast the third broadcast packet to devices in the Bluetooth mesh network other than the third target device; The target data packet is encrypted using the AES symmetric encryption algorithm to obtain a third broadcast packet, which includes: The calculation module is used to obtain the message authentication code by performing a calculation using a cryptographic hash function based on the target data packet and the second public key; The second encryption module is used to encrypt the message authentication code and the target data packet using the second public key to obtain the third broadcast packet.

6. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein, when the program is executed, it controls the device on which the computer-readable storage medium is located to perform the method according to any one of claims 1 to 4.

7. A Bluetooth communication system, characterized in that, include: One or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs comprising methods for performing any one of claims 1 to 4.

Citation Information

Patent Citations

  • Bluetooth networking method of electronic equipment and related equipment

    CN113556711A

  • Bluetooth communication method, first device, second device and storage medium

    CN115767486A

  • On-demand table and route update after a node failure in a wireless network

    US20210119905A1