Communication method, device and system, electronic equipment and storage medium

Through the protocol gateway and the Internet of Things device are connected through Bluetooth, and the control commands of the communication protocol are transmitted using Bluetooth broadcast, solving the problem of restricted communication resources caused by the increase of IoT devices, and achieving efficient and low-power communication.

CN119485790APending Publication Date: 2025-02-18GREE ELECTRIC APPLIANCE INC OF ZHUHAI +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411567427.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-05
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

The increase in IoT devices has led to limited communication resources. The existing technology such as the MQTT protocol uses TCP as the transport layer protocol, resulting in a large consumption of network resources.

Method used

A Bluetooth connection is established with the first terminal device through a protocol gateway, and an account information is allocated to it, and a control command of a preset communication protocol is sent through Bluetooth broadcasting to realize a communication connection with the first terminal device.

Benefits of technology

It effectively avoids the consumption of network resources, ensures efficient communication, and reduces the power consumption of communication.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119485790A_ABST
    Figure CN119485790A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a communication method, device and system, electronic equipment and a storage medium. The method comprises the following steps: establishing Bluetooth connection with first terminal equipment; distributing account information to the first terminal equipment and sending the account information to the first terminal equipment; disconnecting the Bluetooth connection with the first terminal equipment; receiving a connection request of a preset communication protocol sent by the first terminal device through Bluetooth broadcast; the connection request of the preset communication protocol comprises account information; in response to a connection request of a preset communication protocol, establishing a communication connection of the preset communication protocol with the first terminal device according to the account information; and sending the control command of the preset communication protocol to the first terminal equipment through Bluetooth broadcast, so that the first terminal equipment responds to the control command of the preset communication protocol after receiving the control command of the preset communication protocol. Therefore, the control command of the preset communication protocol is transmitted in a Bluetooth broadcast mode, consumption of network resources is avoided, and efficient communication is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication technology, and in particular to a communication method, a communication device, an electronic device and a computer-readable storage medium. Background Art

[0002] With the development of Internet of Things technology, more and more people are using Internet of Things devices. The number of Internet of Things devices in users' homes is also increasing. Therefore, a large number of Internet of Things devices need to communicate efficiently and with low power consumption. However, the increase of Internet of Things devices will lead to limited communication resources. Therefore, MQTT (Message Queuing Telemetry Transport, a lightweight message transmission protocol) is usually used for data transmission in related technologies. However, MQTT uses TCP (Transmission Control Protocol) as the transport layer protocol, which will still cause certain network resource consumption. Summary of the invention

[0003] In view of the above problems, embodiments of the present invention are proposed to provide a communication method, a communication device, an electronic device and a computer-readable storage medium that overcome the above problems or at least partially solve the above problems.

[0004] In order to solve the above problem, an embodiment of the present invention discloses a communication method, which is applied to a protocol gateway and includes:

[0005] Establishing a Bluetooth connection with the first terminal device;

[0006] Allocating account information to the first terminal device and sending the account information to the first terminal device;

[0007] Disconnecting the Bluetooth connection with the first terminal device;

[0008] Receiving a connection request of a preset communication protocol sent by the first terminal device via Bluetooth broadcast; the connection request of the preset communication protocol includes the account information;

[0009] In response to the connection request of the preset communication protocol, a communication connection of the preset communication protocol is established with the first terminal device according to the account information;

[0010] The control command of the preset communication protocol is sent to the first terminal device via Bluetooth broadcasting, so that the first terminal device responds to the control command of the preset communication protocol after receiving the control command of the preset communication protocol.

[0011] Optionally, it also includes:

[0012] Generate a key, and send the key to a second terminal device, so that after the second terminal device establishes a connection with the first terminal device, the key is sent to the first terminal device;

[0013] The establishing a Bluetooth connection with the first terminal device includes:

[0014] Receive the Bluetooth connection request sent by the first terminal device, and respond to the Bluetooth connection request sent by the first terminal device to establish a Bluetooth connection with the first terminal device; after receiving the key, the first terminal device disconnects the connection with the second terminal device and sends the Bluetooth connection request to the protocol gateway.

[0015] Optionally, allocating account information to the first terminal device and sending the account information to the first terminal device includes:

[0016] Determine account information;

[0017] Encrypting the account information by using the key to obtain encrypted account information;

[0018] The encrypted account information is sent to the first terminal device, so that the first terminal device decrypts the encrypted account information according to the key to obtain the account information.

[0019] Optionally, responding to the connection request of the preset communication protocol and establishing a communication connection of the preset communication protocol with the first terminal device according to the account information includes:

[0020] In response to the connection request of the preset communication protocol, a registration request is sent to the server according to the account information;

[0021] Receive a registration success message returned by the server according to the registration request, and establish a communication connection of the preset communication protocol with the first terminal device.

[0022] Optionally, sending the control command of the preset communication protocol to the first terminal device through Bluetooth broadcasting includes:

[0023] Acquiring control information sent by the server; the control information is sent by the second terminal device to the server;

[0024] The control information is converted into a control command of a preset communication protocol, and the control command of the preset communication protocol is sent to the first terminal device via Bluetooth broadcast.

[0025] The embodiment of the present invention further discloses a communication method, which is applied to a first terminal device and includes:

[0026] Establish a Bluetooth connection with the protocol gateway;

[0027] Receiving account information sent by the protocol gateway; the account information is allocated by the protocol gateway to the first terminal device;

[0028] Disconnecting the Bluetooth connection with the protocol gateway;

[0029] A connection request of a preset communication protocol is sent to the protocol gateway via Bluetooth broadcast, so that the protocol gateway responds to the connection request of the preset communication protocol and establishes a communication connection of the preset communication protocol with the first terminal device according to the account information; the connection request of the preset communication protocol includes the account information;

[0030] Acquire the control command of the preset communication protocol sent by the protocol gateway via Bluetooth broadcast, and respond to the control command of the preset communication protocol.

[0031] Optionally, establishing a Bluetooth connection with a protocol gateway includes:

[0032] Establishing a connection with a second terminal device and receiving a key sent by the second terminal device; after the key is generated by the protocol gateway, sending the key to the second terminal device;

[0033] After receiving the key, disconnect the connection with the second terminal device and send a Bluetooth connection request to the protocol gateway, so that the protocol gateway receives the Bluetooth connection request sent by the first terminal device, responds to the Bluetooth connection request sent by the first terminal device, and establishes a Bluetooth connection with the first terminal device.

[0034] Optionally, the receiving the account information sent by the protocol gateway includes:

[0035] Receiving the encrypted account information sent by the protocol gateway; the encrypted account information is obtained by encrypting the account information by the key after the protocol gateway determines the account information;

[0036] The encrypted account information is decrypted according to the key to obtain the account information.

[0037] Optionally, the control command of the preset communication protocol is obtained by the protocol gateway acquiring control information sent by the server and converting the control information; the control information is sent to the server by the second terminal device.

[0038] An embodiment of the present invention discloses a communication system, the system comprising: a protocol gateway and a first terminal device;

[0039] The protocol gateway is used to establish a Bluetooth connection with a first terminal device; allocate account information to the first terminal device and send the account information to the first terminal device; disconnect the Bluetooth connection with the first terminal device; receive a connection request of a preset communication protocol sent by the first terminal device via Bluetooth broadcast; the connection request of the preset communication protocol includes the account information; respond to the connection request of the preset communication protocol, establish a communication connection of the preset communication protocol with the first terminal device according to the account information; send a control command of the preset communication protocol to the first terminal device via Bluetooth broadcast;

[0040] The first terminal device is used to establish a Bluetooth connection with the protocol gateway; receive account information sent by the protocol gateway; disconnect the Bluetooth connection with the protocol gateway; send a connection request of a preset communication protocol to the protocol gateway via Bluetooth broadcast; obtain a control command of the preset communication protocol sent by the protocol gateway via Bluetooth broadcast, and respond to the control command of the preset communication protocol.

[0041] Optionally, the system further includes a second terminal device;

[0042] The protocol gateway is further used to generate a key and send the key to the second terminal device; receive a Bluetooth connection request sent by the first terminal device, and respond to the Bluetooth connection request sent by the first terminal device to establish a Bluetooth connection with the first terminal device;

[0043] The first terminal device is used to establish a connection with the second terminal device, receive the key sent by the second terminal device; disconnect the connection with the second terminal device, and send the Bluetooth connection request to the protocol gateway;

[0044] The second terminal device is used to receive the key sent by the protocol gateway; establish a connection with the first terminal device, send the key to the first terminal device; and disconnect the connection with the first terminal device.

[0045] Optionally, the protocol gateway is used to determine account information; encrypt the account information using the key to obtain encrypted account information; and send the encrypted account information to the first terminal device;

[0046] The first terminal is used to receive the encrypted account information sent by the protocol gateway, and decrypt the encrypted account information according to the key to obtain the account information.

[0047] Optionally, the system further comprises a server;

[0048] The protocol gateway is used to respond to the connection request of the preset communication protocol, send a registration request to the server according to the account information; receive a registration success message returned by the server according to the registration request, and establish a communication connection of the preset communication protocol with the first terminal device;

[0049] The server is configured to receive a registration request sent by the protocol gateway according to the account information, complete the registration according to the registration request, and return a registration success message to the protocol gateway according to the registration request;

[0050] The first terminal is used to establish a communication connection of the preset communication protocol with the protocol gateway.

[0051] Optionally, the system further includes a second terminal;

[0052] The protocol gateway is used to obtain the control information sent by the server; convert the control information into a control command of a preset communication protocol, and send the control command of the preset communication protocol to the first terminal device via Bluetooth broadcast;

[0053] The server is used to obtain the control information sent by the second terminal and send the control information to the protocol gateway;

[0054] The first terminal is used to receive the control command of the preset communication protocol sent by the protocol gateway via Bluetooth broadcast;

[0055] The first terminal is used to send the control information to the server.

[0056] The embodiment of the present invention further discloses a communication device, which is applied to a protocol gateway and includes:

[0057] A first connection module, used to establish a Bluetooth connection with a first terminal device;

[0058] A first sending module, configured to allocate account information to the first terminal device and send the account information to the first terminal device;

[0059] A first disconnection module, used to disconnect the Bluetooth connection with the first terminal device;

[0060] A first receiving module, configured to receive a connection request of a preset communication protocol sent by the first terminal device via Bluetooth broadcast; the connection request of the preset communication protocol includes the account information;

[0061] A second connection module, configured to respond to a connection request of the preset communication protocol and establish a communication connection of the preset communication protocol with the first terminal device according to the account information;

[0062] The second sending module is used to send the control command of the preset communication protocol to the first terminal device through Bluetooth broadcast, so that the first terminal device responds to the control command of the preset communication protocol after receiving the control command of the preset communication protocol.

[0063] Optionally, the device further comprises:

[0064] A generating module, used for generating a key, and sending the key to a second terminal device, so that after the second terminal device establishes a connection with the first terminal device, the key is sent to the first terminal device;

[0065] The first connection module includes:

[0066] The first connection submodule is used to receive a Bluetooth connection request sent by the first terminal device, and respond to the Bluetooth connection request sent by the first terminal device to establish a Bluetooth connection with the first terminal device; after the first terminal device receives the key, the Bluetooth connection request is disconnected from the second terminal device and the Bluetooth connection request is sent to the protocol gateway.

[0067] Optionally, the first sending module includes:

[0068] A determination submodule is used to determine account information;

[0069] An encryption submodule, used to encrypt the account information using the key to obtain encrypted account information;

[0070] The first sending submodule is used to send the encrypted account information to the first terminal device, so that the first terminal device decrypts the encrypted account information according to the key to obtain the account information.

[0071] Optionally, the second connection module includes:

[0072] A second sending submodule, configured to respond to the connection request of the preset communication protocol and send a registration request to the server according to the account information;

[0073] The second connection submodule is used to receive the registration success message returned by the server according to the registration request, and establish a communication connection of the preset communication protocol with the first terminal device.

[0074] Optionally, the second sending module includes:

[0075] An acquisition submodule, used for acquiring control information sent by the server; the control information is sent to the server by the second terminal device;

[0076] The third sending submodule is used to convert the control information into a control command of a preset communication protocol, and send the control command of the preset communication protocol to the first terminal device via Bluetooth broadcast.

[0077] The embodiment of the present invention further discloses a communication device, which is applied to a first terminal and includes:

[0078] A third connection module, used to establish a Bluetooth connection with the protocol gateway;

[0079] A second receiving module, configured to receive the account information sent by the protocol gateway; the account information is allocated by the protocol gateway to the first terminal device;

[0080] A second disconnection module, used to disconnect the Bluetooth connection with the protocol gateway;

[0081] A third sending module is used to send a connection request of a preset communication protocol to the protocol gateway via Bluetooth broadcast, so that the protocol gateway responds to the connection request of the preset communication protocol and establishes a communication connection of the preset communication protocol with the first terminal device according to the account information; the connection request of the preset communication protocol includes the account information;

[0082] The acquisition module is used to acquire the control command of the preset communication protocol sent by the protocol gateway through Bluetooth broadcast, and respond to the control command of the preset communication protocol.

[0083] Optionally, the third connection module includes:

[0084] A first receiving submodule, configured to establish a connection with a second terminal device and receive a key sent by the second terminal device; after the key is generated by the protocol gateway, the key is sent to the second terminal device;

[0085] The fourth sending submodule is used to disconnect the connection with the second terminal device after receiving the key, and send a Bluetooth connection request to the protocol gateway, so that the protocol gateway receives the Bluetooth connection request sent by the first terminal device, responds to the Bluetooth connection request sent by the first terminal device, and establishes a Bluetooth connection with the first terminal device.

[0086] Optionally, the second receiving module includes:

[0087] A second receiving submodule is used to receive the encrypted account information sent by the protocol gateway; the encrypted account information is obtained by encrypting the account information by the key after the protocol gateway determines the account information;

[0088] The decryption submodule is used to decrypt the encrypted account information according to the key to obtain the account information.

[0089] Optionally, the control command of the preset communication protocol is obtained by the protocol gateway acquiring control information sent by the server and converting the control information; the control information is sent to the server by the second terminal device.

[0090] The present invention also discloses a device, comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above communication method when executing the computer program.

[0091] The present invention also discloses a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the communication method described above are implemented.

[0092] The embodiments of the present invention include the following advantages:

[0093] In an embodiment of the present invention, the protocol gateway establishes a Bluetooth connection with the first terminal device, allocates account information to the first terminal and sends the account information to the first terminal device, then disconnects the Bluetooth connection with the first terminal device, and then receives a connection request for a preset communication protocol sent by the first terminal device via Bluetooth broadcast, wherein the connection request for the preset communication protocol includes account information, responds to the connection request for the preset communication protocol, and thereby establishes a communication connection of the preset communication protocol with the first terminal device based on the account information, and finally sends a control command of the preset communication protocol to the first terminal device via blue sky broadcast, so that the first terminal device responds to the control command of the preset communication protocol after receiving the control command of the preset communication protocol, so that the protocol gateway can establish a communication connection of the preset communication protocol with the first terminal device, and send the control command of the preset communication protocol via Bluetooth broadcast. It is precisely because the control command of the preset communication protocol is transmitted by Bluetooth broadcast that the consumption of network resources is avoided and efficient communication is guaranteed. BRIEF DESCRIPTION OF THE DRAWINGS

[0094] Figure 1 is a flow chart of steps of a communication method provided by an embodiment of the present invention;

[0095] Figure 2 is a flowchart of another communication method provided by an embodiment of the present invention;

[0096] Figure 3 is a flowchart of another communication method provided by an embodiment of the present invention;

[0097] Figure 4 is a structural block diagram of a communication system provided by an embodiment of the present invention;

[0098] Figure 5 is a structural block diagram of a communication device provided by an embodiment of the present invention;

[0099] Figure 6 It is a structural block diagram of another communication device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0100] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0101] In the related art, MQTT is usually used for data transmission, but MQTT uses TCP as the transport layer protocol, which will cause certain network resource consumption. In order to solve the above technical problems, the present invention provides a communication method, a protocol gateway establishes a Bluetooth connection with a first terminal device, allocates account information to the first terminal and sends the account information to the first terminal device, then disconnects the Bluetooth connection with the first terminal device, and then receives a connection request of a preset communication protocol sent by the first terminal device via Bluetooth broadcast, wherein the connection request of the preset communication protocol includes account information, responds to the connection request of the preset communication protocol, and thus can establish a communication connection of the preset communication protocol with the first terminal device according to the account information, and finally sends the control command of the preset communication protocol to the first terminal device via blue sky broadcast, so that the first terminal device responds to the control command of the preset communication protocol after receiving the control command of the preset communication protocol, so that the protocol gateway can establish a communication connection of the preset communication protocol with the first terminal device, and send the control command of the preset communication protocol via Bluetooth broadcast, because the control command of the preset communication protocol is transmitted by Bluetooth broadcast, the consumption of network resources is avoided, and efficient communication is guaranteed.

[0102] Reference Figure 1 , shows a flow chart of the steps of a communication method provided by an embodiment of the present invention, the method is applied to a protocol gateway, and the method may specifically include the following steps:

[0103] Step 101: Establish a Bluetooth connection with a first terminal device.

[0104] In an embodiment of the present invention, the protocol gateway needs to establish a Bluetooth connection with the first terminal device before communicating with the first terminal device. In the present invention, the protocol gateway may be an MQTT gateway, and the first terminal device may be a Bluetooth device.

[0105] It should be noted that before the protocol gateway of the present invention establishes a Bluetooth connection with the first terminal device, the protocol gateway may first establish a Bluetooth connection with the second terminal device, and then obtain routing information sent by the second terminal, which may be routing information sent by a preset application deployed in the second terminal, and then the protocol gateway sends a registration request to the server according to the routing information, so that the server responds to the registration information and establishes a connection with the protocol gateway. The second terminal device in the present invention may be a mobile terminal, such as a mobile phone, a tablet, etc.

[0106] In one embodiment, the communication method may further include: generating a key, sending the key to a second terminal device, so that after the second terminal device establishes a connection with the first terminal device, the key is sent to the first terminal device; establishing a Bluetooth connection with the first terminal device may include: receiving a Bluetooth connection request sent by the first terminal device, and responding to the Bluetooth connection request sent by the first terminal device to establish a Bluetooth connection with the first terminal device; after the first terminal device receives the key, the Bluetooth connection request disconnects the connection with the second terminal device and sends the Bluetooth connection request to the protocol gateway.

[0107] Specifically, after the protocol gateway establishes a connection with the server, a key can be generated, which can be a created random string. The generated key is then sent to the second terminal device. After the first terminal device and the second terminal device are connected via Bluetooth, the second terminal device can send the key to the first terminal device. After receiving the key, the first terminal device will disconnect the Bluetooth connection with the second terminal device. Then the first terminal device can send a Bluetooth connection request to the protocol gateway. After receiving the Bluetooth connection request, the protocol gateway can establish a Bluetooth connection with the first terminal device.

[0108] Step 102: Allocate account information to the first terminal device and send the account information to the first terminal device.

[0109] In an embodiment of the present invention, after the protocol gateway establishes a Bluetooth connection with the first terminal device, account information can be allocated to the first terminal device, and the account information may be usename, password, etc., and then the protocol gateway sends the account information to the first terminal device.

[0110] In one embodiment, allocating account information to a first terminal device and sending the account information to the first terminal device may include: determining the account information; encrypting the account information using a key to obtain encrypted account information; and sending the encrypted account information to the first terminal device so that the first terminal device decrypts the encrypted account information according to the key to obtain the account information.

[0111] Specifically, for example, if the key is key A, after the protocol gateway determines the account information, it can encrypt the account information through key A to obtain encrypted account information, and then send the encrypted account information to the first terminal device. The first terminal device decrypts the encrypted account information through key A to obtain the account information, so that the data can be protected by key A, effectively preventing the leakage of account information.

[0112] Step 103: disconnect the Bluetooth connection with the first terminal device.

[0113] In the embodiment of the present invention, after sending the account information to the first terminal device, the protocol gateway may disconnect the Bluetooth connection with the first terminal device.

[0114] Step 104: receiving a connection request of a preset communication protocol sent by the first terminal device via Bluetooth broadcast; the connection request of the preset communication protocol includes the account information.

[0115] In an embodiment of the present invention, after the protocol gateway disconnects the Bluetooth connection with the first terminal device, the first terminal device sends a connection request of a preset communication protocol via Bluetooth broadcast. In the present invention, the preset communication protocol may be the MQTT protocol. The connection request of the preset communication protocol may include account information.

[0116] For example, after the protocol gateway disconnects the Bluetooth connection with the first terminal device, the first terminal device broadcasts a connect packet using Bluetooth and waits for a connect ack reply from the protocol gateway. After receiving the connect ack reply from the protocol gateway, the first terminal device can communicate with the protocol gateway using a preset communication protocol.

[0117] Step 105 , responding to the connection request of the preset communication protocol, and establishing a communication connection of the preset communication protocol with the first terminal device according to the account information.

[0118] In an embodiment of the present invention, after receiving a connection request for a preset communication protocol sent by the first terminal via Bluetooth broadcast, the protocol gateway can respond to the connection request for the preset communication protocol, and when the account information meets the preset requirements, or when the account information is previously generated account information, a communication connection for the preset communication protocol can be established with the first terminal device.

[0119] In one embodiment, responding to a connection request of a preset communication protocol, establishing a communication connection of the preset communication protocol with the first terminal device according to the account information includes: responding to the connection request of the preset communication protocol, sending a registration request to the server according to the account information; receiving a registration success message returned by the server according to the registration request, and establishing a communication connection of the preset communication protocol with the first terminal device.

[0120] Specifically, after receiving a connection request for a preset communication protocol sent by the first terminal device via Bluetooth broadcast, the protocol gateway can send a registration request to the server based on the account information so that the account information of the first terminal device is stored in the server. The server can then send control information to the first terminal device based on the account information. After the server registration is successful, a registration success message can be returned to the protocol gateway. After receiving the registration success message, the protocol gateway can establish a communication connection of the preset communication protocol with the first terminal device.

[0121] In the present invention, after the first terminal device establishes a communication connection with the protocol gateway using a preset communication protocol, it can use Bluetooth broadcast to subscribe to the corresponding topic and report the relevant status. After the server registration is successful, a registration success message can be sent to the second terminal device, and the terminal device can display the corresponding second terminal device as being in an activated state.

[0122] Step 106: Send the control command of the preset communication protocol to the first terminal device via Bluetooth broadcast, so that the first terminal device responds to the control command of the preset communication protocol after receiving the control command of the preset communication protocol.

[0123] In an embodiment of the present invention, after the protocol gateway establishes a communication connection of a preset communication protocol with the first terminal device, the protocol gateway can send a control command of the preset communication protocol to the first terminal device via Bluetooth broadcast. After the first terminal device receives the control command of the preset communication protocol, it can respond to the control command of the preset communication protocol.

[0124] In one embodiment, a control command of a preset communication protocol is sent to a first terminal device via Bluetooth broadcast, including: obtaining control information sent by a server; the control information is sent by a second terminal device to the server; the control information is converted into a control command of a preset communication protocol, and the control command of the preset communication protocol is sent to the first terminal device via Bluetooth broadcast.

[0125] Specifically, when the user needs to control the first terminal device, the user can send relevant control information to the server through the second terminal device. After receiving the control information, the server can send the control information to the protocol gateway. The protocol gateway can convert the control information into a control command of a preset communication protocol, and then send the control command of the preset communication protocol to the first terminal device via Bluetooth broadcast, thereby controlling the first terminal device through the second terminal device.

[0126] In an embodiment of the present invention, after the protocol gateway establishes a communication connection of a preset communication protocol with the first terminal device, the first terminal device can send heartbeat information of the preset communication protocol to the protocol gateway at a first preset frequency. After the protocol gateway receives the heartbeat information sent by the first terminal device, it can return a corresponding heartbeat response to the first terminal device, thereby ensuring continuous connection and communication between the first terminal and the protocol gateway.

[0127] In order to better understand the embodiments of the present invention, Figure 2 As shown, another communication method provided by an embodiment of the present invention is shown. The second terminal establishes a Bluetooth connection with the protocol gateway and transmits routing information to the protocol gateway. The protocol gateway establishes a connection with the server according to the routing information. The protocol gateway generates a key and sends the key to the second terminal, and then the broadcast can be released again to wait for the identification connection. After the second terminal receives the key, it can establish a Bluetooth connection with the first terminal device. After the connection is successful, the key can be sent to the first terminal device. After receiving the key, the first terminal device can disconnect the Bluetooth connection with the second terminal. After the first terminal disconnects the Bluetooth connection with the second terminal, it can establish a Bluetooth connection with the protocol gateway. Then the protocol gateway can allocate account information to the first terminal device and encrypt the account information based on the key. The first terminal device can use the key to decrypt the encrypted account information to obtain the account information. Then the first terminal device disconnects the Bluetooth connection with the protocol gateway and sends a connection request of the preset communication protocol to the protocol gateway through Bluetooth broadcast. After receiving the connection request of the preset communication protocol, the protocol gateway will register the account information of the first terminal device to the server. After the registration is successful, the protocol gateway can establish a communication connection of the preset communication protocol with the first terminal device.

[0128] In an embodiment of the present invention, a Bluetooth connection is established with a first terminal device; account information is allocated to the first terminal device and the account information is sent to the first terminal device; the Bluetooth connection with the first terminal device is disconnected; a connection request of a preset communication protocol sent by the first terminal device via Bluetooth broadcast is received; the connection request of the preset communication protocol includes account information; the connection request of the preset communication protocol is responded to, and a communication connection of the preset communication protocol is established with the first terminal device according to the account information; a control command of the preset communication protocol is sent to the first terminal device via Bluetooth broadcast, so that the first terminal device responds to the control command of the preset communication protocol after receiving the control command of the preset communication protocol. Thus, the protocol gateway can establish a communication connection of the preset communication protocol with the first terminal device, and send the control command of the preset communication protocol via Bluetooth broadcast. It is precisely because the control command of the preset communication protocol is transmitted by Bluetooth broadcast that the consumption of network resources is avoided and efficient communication is guaranteed.

[0129] like Figure 3FIG. 1 is a flowchart of another communication method provided by an embodiment of the present invention. The method is applied to a first terminal device and may specifically include the following steps:

[0130] Step 301: Establish a Bluetooth connection with a protocol gateway.

[0131] In an embodiment of the present invention, the protocol gateway needs to establish a Bluetooth connection with the first terminal device before communicating with the first terminal device. In the present invention, the protocol gateway may be an MQTT gateway, and the first terminal device may be a Bluetooth device.

[0132] It should be noted that before the protocol gateway of the present invention establishes a Bluetooth connection with the first terminal device, the protocol gateway may first establish a Bluetooth connection with the second terminal device, and then obtain routing information sent by the second terminal, which may be routing information sent by a preset application deployed in the second terminal, and then the protocol gateway sends a registration request to the server according to the routing information, so that the server responds to the registration information and establishes a connection with the protocol gateway. The second terminal device in the present invention may be a mobile terminal, such as a mobile phone, a tablet, etc.

[0133] In one embodiment, establishing a Bluetooth connection with a protocol gateway may include: establishing a connection with a second terminal device and receiving a key sent by the second terminal device; after the key is generated by the protocol gateway, sending the key to the second terminal device; after receiving the key, disconnecting from the second terminal device and sending a Bluetooth connection request to the protocol gateway, so that the protocol gateway receives the Bluetooth connection request sent by the first terminal device, responds to the Bluetooth connection request sent by the first terminal device, and establishes a Bluetooth connection with the first terminal device.

[0134] Specifically, after the protocol gateway establishes a connection with the server, a key can be generated, which can be a created random string. The generated key is then sent to the second terminal device. After the first terminal device and the second terminal device are connected via Bluetooth, the second terminal device can send the key to the first terminal device. After receiving the key, the first terminal device will disconnect the Bluetooth connection with the second terminal device. Then the first terminal device can send a Bluetooth connection request to the protocol gateway. After receiving the Bluetooth connection request, the protocol gateway can establish a Bluetooth connection with the first terminal device.

[0135] Step 302, receiving the account information sent by the protocol gateway; the account information is allocated by the protocol gateway to the first terminal device.

[0136] In an embodiment of the present invention, after the protocol gateway establishes a Bluetooth connection with the first terminal device, account information can be allocated to the first terminal device, and the account information may be usename, password, etc., and then the protocol gateway sends the account information to the first terminal device.

[0137] In one embodiment, receiving account information sent by a protocol gateway may include: receiving encrypted account information sent by the protocol gateway; after the protocol gateway determines the account information, encrypting the account information with a key to obtain the encrypted account information; and decrypting the encrypted account information according to the key to obtain the account information.

[0138] Specifically, for example, if the key is key A, after the protocol gateway determines the account information, it can encrypt the account information through key A to obtain encrypted account information, and then send the encrypted account information to the first terminal device. The first terminal device decrypts the encrypted account information through key A to obtain the account information, so that the data can be protected by key A, effectively preventing the leakage of account information.

[0139] Step 303: disconnect the Bluetooth connection with the protocol gateway.

[0140] In the embodiment of the present invention, after receiving the account information sent by the protocol gateway, the first terminal device may disconnect the Bluetooth connection with the protocol gateway.

[0141] Step 304: A connection request of a preset communication protocol is sent to the protocol gateway via Bluetooth broadcast, so that the protocol gateway responds to the connection request of the preset communication protocol and establishes a communication connection of the preset communication protocol with the first terminal device according to the account information; the connection request of the preset communication protocol includes the account information.

[0142] In an embodiment of the present invention, after the first terminal device disconnects the Bluetooth connection with the protocol gateway, the first terminal device sends a connection request of a preset communication protocol via Bluetooth broadcast. In the present invention, the preset communication protocol may be the MQTT protocol. The connection request of the preset communication protocol may include account information.

[0143] After receiving a connection request for a preset communication protocol sent by the first terminal via Bluetooth broadcast, the protocol gateway can respond to the connection request for the preset communication protocol and establish a communication connection for the preset communication protocol with the first terminal device when the account information meets the preset requirements or the account information is previously generated account information.

[0144] Step 305: Acquire the control command of the preset communication protocol sent by the protocol gateway via Bluetooth broadcast, and respond to the control command of the preset communication protocol.

[0145] In the embodiment of the present invention, after the protocol gateway establishes a communication connection of the preset communication protocol with the first terminal device, the protocol gateway can send the control command of the preset communication protocol to the first terminal device through Bluetooth broadcast, and after the first terminal device receives the control command of the preset communication protocol, it can respond to the control command of the preset communication protocol. The control command of the preset communication protocol is obtained by the protocol gateway obtaining the control information sent by the server and converting the control information; the control information is sent to the server by the second terminal device.

[0146] Specifically, when the user needs to control the first terminal device, the user can send relevant control information to the server through the second terminal device. After receiving the control information, the server can send the control information to the protocol gateway. The protocol gateway can convert the control information into a control command of a preset communication protocol, and then send the control command of the preset communication protocol to the first terminal device via Bluetooth broadcast, thereby controlling the first terminal device through the second terminal device.

[0147] In an embodiment of the present invention, a Bluetooth connection is established with a first terminal device; account information is allocated to the first terminal device and the account information is sent to the first terminal device; the Bluetooth connection with the first terminal device is disconnected; a connection request of a preset communication protocol sent by the first terminal device via Bluetooth broadcast is received; the connection request of the preset communication protocol includes account information; the connection request of the preset communication protocol is responded to, and a communication connection of the preset communication protocol is established with the first terminal device according to the account information; a control command of the preset communication protocol is sent to the first terminal device via Bluetooth broadcast, so that the first terminal device responds to the control command of the preset communication protocol after receiving the control command of the preset communication protocol. Thus, the protocol gateway can establish a communication connection of the preset communication protocol with the first terminal device, and send the control command of the preset communication protocol via Bluetooth broadcast. It is precisely because the control command of the preset communication protocol is transmitted by Bluetooth broadcast that the consumption of network resources is avoided and efficient communication is guaranteed.

[0148] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.

[0149] like Figure 4 , which shows a structural block diagram of a communication system provided by an embodiment of the present invention, the communication system includes: a protocol gateway 41 and a first terminal device 42.

[0150] The protocol gateway 41 is used to establish a Bluetooth connection with the first terminal device 42; allocate account information to the first terminal device 42 and send the account information to the first terminal device 42; disconnect the Bluetooth connection with the first terminal device 42; receive a connection request of a preset communication protocol sent by the first terminal device 42 via Bluetooth broadcast; the connection request of the preset communication protocol includes the account information; respond to the connection request of the preset communication protocol, establish a communication connection of the preset communication protocol with the first terminal device 42 according to the account information; send a control command of the preset communication protocol to the first terminal device 42 via Bluetooth broadcast;

[0151] The first terminal device 42 is used to establish a Bluetooth connection with the protocol gateway 41; receive account information sent by the protocol gateway 41; disconnect the Bluetooth connection with the protocol gateway 41; send a connection request of a preset communication protocol to the protocol gateway 41 via Bluetooth broadcast; obtain a control command of the preset communication protocol sent by the protocol gateway 41 via Bluetooth broadcast, and respond to the control command of the preset communication protocol.

[0152] In one embodiment, the system further includes a second terminal device;

[0153] The protocol gateway 41 is further used to generate a key and send the key to the second terminal device; receive a Bluetooth connection request sent by the first terminal device 42, and respond to the Bluetooth connection request sent by the first terminal device 42 to establish a Bluetooth connection with the first terminal device 42;

[0154] The first terminal device 42 is used to establish a connection with the second terminal device, receive the key sent by the second terminal, disconnect the connection with the second terminal device, and send the Bluetooth connection request to the protocol gateway 41;

[0155] The second terminal device is used to receive the key sent by the protocol gateway 41; establish a connection with the first terminal device 42, send the key to the first terminal device 42; and disconnect the connection with the first terminal device 42.

[0156] In one embodiment, the protocol gateway 41 is used to determine the account information; encrypt the account information by using the key to obtain the encrypted account information; and send the encrypted account information to the first terminal device 42;

[0157] The first terminal is used to receive the encrypted account information sent by the protocol gateway 41, and decrypt the encrypted account information according to the key to obtain the account information.

[0158] In one embodiment, the system further comprises a server;

[0159] The protocol gateway 41 is used to respond to the connection request of the preset communication protocol, send a registration request to the server according to the account information; receive a registration success message returned by the server according to the registration request, and establish a communication connection of the preset communication protocol with the first terminal device 42;

[0160] The server is used to receive the registration request sent by the protocol gateway 41 according to the account information, complete the registration according to the registration request, and return a registration success message to the protocol gateway 41 according to the registration request;

[0161] The first terminal is used to establish a communication connection of the preset communication protocol with the protocol gateway 41.

[0162] In one embodiment, the system further comprises a second terminal;

[0163] The protocol gateway 41 is used to obtain the control information sent by the server; convert the control information into a control command of a preset communication protocol, and send the control command of the preset communication protocol to the first terminal device 42 via Bluetooth broadcast;

[0164] The server is used to obtain the control information sent by the second terminal, and send the control information to the protocol gateway 41;

[0165] The first terminal is used to receive the control command of the preset communication protocol sent by the protocol gateway 41 via Bluetooth broadcast;

[0166] The first terminal is used to send the control information to the server.

[0167] In an embodiment of the present invention, a protocol gateway is used to establish a Bluetooth connection with a first terminal device; allocate account information to the first terminal device and send the account information to the first terminal device; disconnect the Bluetooth connection with the first terminal device; receive a connection request of a preset communication protocol sent by the first terminal device via Bluetooth broadcast; the connection request of the preset communication protocol includes account information; respond to the connection request of the preset communication protocol, establish a communication connection of the preset communication protocol with the first terminal device according to the account information; send a control command of the preset communication protocol to the first terminal device via Bluetooth broadcast; the first terminal device is used to establish a Bluetooth connection with the protocol gateway; receive the account information sent by the protocol gateway; disconnect the Bluetooth connection with the protocol gateway; send a connection request of the preset communication protocol to the protocol gateway via Bluetooth broadcast; obtain the control command of the preset communication protocol sent by the protocol gateway via Bluetooth broadcast, and respond to the control command of the preset communication protocol. Thus, the protocol gateway can establish a communication connection of the preset communication protocol with the first terminal device, and send the control command of the preset communication protocol via Bluetooth broadcast. It is precisely because the control command of the preset communication protocol is transmitted by Bluetooth broadcast that the consumption of network resources is avoided and efficient communication is guaranteed.

[0168] Reference Figure 5 , shows a structural block diagram of a communication device provided by an embodiment of the present invention, the device is applied to a protocol gateway, and specifically may include the following modules:

[0169] The first connection module 501 is used to establish a Bluetooth connection with a first terminal device;

[0170] A first sending module 502, configured to allocate account information to the first terminal device and send the account information to the first terminal device;

[0171] A first disconnection module 503, used to disconnect the Bluetooth connection with the first terminal device;

[0172] A first receiving module 504 is used to receive a connection request of a preset communication protocol sent by the first terminal device via Bluetooth broadcast; the connection request of the preset communication protocol includes the account information;

[0173] A second connection module 505, configured to respond to a connection request of the preset communication protocol and establish a communication connection of the preset communication protocol with the first terminal device according to the account information;

[0174] The second sending module 506 is used to send the control command of the preset communication protocol to the first terminal device through Bluetooth broadcasting, so that the first terminal device responds to the control command of the preset communication protocol after receiving the control command of the preset communication protocol.

[0175] In one embodiment, the device further comprises:

[0176] A generating module, used for generating a key, and sending the key to a second terminal device, so that after the second terminal device establishes a connection with the first terminal device, the key is sent to the first terminal device;

[0177] The first connection module 501 includes:

[0178] The first connection submodule is used to receive a Bluetooth connection request sent by the first terminal device, and respond to the Bluetooth connection request sent by the first terminal device to establish a Bluetooth connection with the first terminal device; after the first terminal device receives the key, the Bluetooth connection request is disconnected from the second terminal device and the Bluetooth connection request is sent to the protocol gateway.

[0179] In one embodiment, the first sending module 502 includes:

[0180] A determination submodule is used to determine account information;

[0181] An encryption submodule, used to encrypt the account information using the key to obtain encrypted account information;

[0182] The first sending submodule is used to send the encrypted account information to the first terminal device, so that the first terminal device decrypts the encrypted account information according to the key to obtain the account information.

[0183] In one embodiment, the second connection module 505 includes:

[0184] A second sending submodule, configured to respond to the connection request of the preset communication protocol and send a registration request to the server according to the account information;

[0185] The second connection submodule is used to receive the registration success message returned by the server according to the registration request, and establish a communication connection of the preset communication protocol with the first terminal device.

[0186] In one embodiment, the second sending module 506 includes:

[0187] An acquisition submodule, used for acquiring control information sent by the server; the control information is sent to the server by the second terminal device;

[0188] The third sending submodule is used to convert the control information into a control command of a preset communication protocol, and send the control command of the preset communication protocol to the first terminal device via Bluetooth broadcast.

[0189] In an embodiment of the present invention, a first connection module is used to establish a Bluetooth connection with a first terminal device; a first sending module is used to allocate account information to the first terminal device and send the account information to the first terminal device; a first disconnection module is used to disconnect the Bluetooth connection with the first terminal device; a first receiving module is used to receive a connection request of a preset communication protocol sent by the first terminal device via Bluetooth broadcast; the connection request of the preset communication protocol includes account information; a second connection module is used to respond to the connection request of the preset communication protocol and establish a communication connection of the preset communication protocol with the first terminal device according to the account information; a second sending module is used to send a control command of the preset communication protocol to the first terminal device via Bluetooth broadcast, so that the first terminal device responds to the control command of the preset communication protocol after receiving the control command of the preset communication protocol. Thus, the protocol gateway can establish a communication connection of the preset communication protocol with the first terminal device and send the control command of the preset communication protocol via Bluetooth broadcast. It is precisely because the control command of the preset communication protocol is transmitted by Bluetooth broadcast that the consumption of network resources is avoided and efficient communication is guaranteed.

[0190] Reference Figure 6 , shows a structural block diagram of a communication device provided by an embodiment of the present invention, the device is applied to a first terminal device, and may specifically include the following modules:

[0191] The third connection module 601 is used to establish a Bluetooth connection with the protocol gateway;

[0192] The second receiving module 602 is used to receive the account information sent by the protocol gateway; the account information is allocated by the protocol gateway to the first terminal device;

[0193] A second disconnection module 603, used to disconnect the Bluetooth connection with the protocol gateway;

[0194] A third sending module 604 is configured to send a connection request of a preset communication protocol to the protocol gateway via Bluetooth broadcast, so that the protocol gateway responds to the connection request of the preset communication protocol and establishes a communication connection of the preset communication protocol with the first terminal device according to the account information; the connection request of the preset communication protocol includes the account information;

[0195] The acquisition module 605 is used to acquire the control command of the preset communication protocol sent by the protocol gateway through Bluetooth broadcast, and respond to the control command of the preset communication protocol.

[0196] In one embodiment, the third connection module 601 includes:

[0197] A first receiving submodule, configured to establish a connection with a second terminal device and receive a key sent by the second terminal device; after the key is generated by the protocol gateway, the key is sent to the second terminal device;

[0198] The fourth sending submodule is used to disconnect the connection with the second terminal device after receiving the key, and send a Bluetooth connection request to the protocol gateway, so that the protocol gateway receives the Bluetooth connection request sent by the first terminal device, responds to the Bluetooth connection request sent by the first terminal device, and establishes a Bluetooth connection with the first terminal device.

[0199] In one embodiment, the second receiving module 602 includes:

[0200] A second receiving submodule is used to receive the encrypted account information sent by the protocol gateway; the encrypted account information is obtained by encrypting the account information by the key after the protocol gateway determines the account information;

[0201] The decryption submodule is used to decrypt the encrypted account information according to the key to obtain the account information.

[0202] In one embodiment, the control command of the preset communication protocol is obtained by the protocol gateway acquiring control information sent by the server and converting the control information; the control information is sent by the second terminal device to the server.

[0203] In an embodiment of the present invention, the third connection module is used to establish a Bluetooth connection with the protocol gateway; the second receiving module is used to receive the account information sent by the protocol gateway; the account information is allocated by the protocol gateway to the first terminal device; the second disconnection module is used to disconnect the Bluetooth connection with the protocol gateway; the third sending module is used to send a connection request of the preset communication protocol to the protocol gateway via Bluetooth broadcast, so that the protocol gateway responds to the connection request of the preset communication protocol and establishes a communication connection of the preset communication protocol with the first terminal device according to the account information; the connection request of the preset communication protocol includes the account information; the acquisition module is used to acquire the control command of the preset communication protocol sent by the protocol gateway via Bluetooth broadcast, and respond to the control command of the preset communication protocol. Thus, the protocol gateway can establish a communication connection of the preset communication protocol with the first terminal device, and send the control command of the preset communication protocol via Bluetooth broadcast. It is precisely because the control command of the preset communication protocol is transmitted by Bluetooth broadcast that the consumption of network resources is avoided and efficient communication is guaranteed.

[0204] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0205] An embodiment of the present invention further provides an electronic device, including:

[0206] It includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, the various processes of the above-mentioned communication method embodiment are implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0207] An embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the various processes of the above-mentioned communication method embodiment are implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0208] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0209] It will be appreciated by those skilled in the art that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0210] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0211] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1A function specified in one or more boxes.

[0212] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0213] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.

[0214] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.

[0215] The communication method, the communication device, the electronic device and the computer-readable storage medium provided by the present invention are introduced in detail above. The principle and implementation mode of the present invention are explained in detail by using specific examples herein. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for a person skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation mode and the scope of application. In summary, the content of this specification should not be understood as limiting the present invention.

Claims

1. A communication method, characterized in that: The method is applied to a protocol gateway, and the method comprises: Establishing a Bluetooth connection with the first terminal device; Allocating account information to the first terminal device and sending the account information to the first terminal device; Disconnecting the Bluetooth connection with the first terminal device; Receiving a connection request of a preset communication protocol sent by the first terminal device via Bluetooth broadcast; the connection request of the preset communication protocol includes the account information; In response to the connection request of the preset communication protocol, a communication connection of the preset communication protocol is established with the first terminal device according to the account information; The control command of the preset communication protocol is sent to the first terminal device via Bluetooth broadcasting, so that the first terminal device responds to the control command of the preset communication protocol after receiving the control command of the preset communication protocol.

2. The communication method according to claim 1, characterized in that: Also includes: Generate a key, and send the key to a second terminal device, so that after the second terminal device establishes a connection with the first terminal device, the key is sent to the first terminal device; The establishing a Bluetooth connection with the first terminal device includes: Receive the Bluetooth connection request sent by the first terminal device, and respond to the Bluetooth connection request sent by the first terminal device to establish a Bluetooth connection with the first terminal device; after receiving the key, the first terminal device disconnects the connection with the second terminal device and sends the Bluetooth connection request to the protocol gateway.

3. The communication method according to claim 2, characterized in that: The allocating account information to the first terminal device and sending the account information to the first terminal device includes: Determine account information; Encrypting the account information by using the key to obtain encrypted account information; The encrypted account information is sent to the first terminal device, so that the first terminal device decrypts the encrypted account information according to the key to obtain the account information.

4. The communication method according to claim 1, characterized in that: The responding to the connection request of the preset communication protocol and establishing a communication connection of the preset communication protocol with the first terminal device according to the account information includes: In response to the connection request of the preset communication protocol, a registration request is sent to the server according to the account information; Receive a registration success message returned by the server according to the registration request, and establish a communication connection of the preset communication protocol with the first terminal device.

5. The communication method according to claim 4, characterized in that: The sending the control command of the preset communication protocol to the first terminal device through Bluetooth broadcasting includes: Acquiring control information sent by the server; the control information is sent by the second terminal device to the server; The control information is converted into a control command of a preset communication protocol, and the control command of the preset communication protocol is sent to the first terminal device via Bluetooth broadcast.

6. A communication method, characterized in that: The method is applied to a first terminal device, and the method includes: Establish a Bluetooth connection with the protocol gateway; Receiving account information sent by the protocol gateway; the account information is allocated by the protocol gateway to the first terminal device; Disconnecting the Bluetooth connection with the protocol gateway; A connection request of a preset communication protocol is sent to the protocol gateway via Bluetooth broadcast, so that the protocol gateway responds to the connection request of the preset communication protocol and establishes a communication connection of the preset communication protocol with the first terminal device according to the account information; the connection request of the preset communication protocol includes the account information; Acquire the control command of the preset communication protocol sent by the protocol gateway via Bluetooth broadcast, and respond to the control command of the preset communication protocol.

7. The communication method according to claim 6, characterized in that: The step of establishing a Bluetooth connection with the protocol gateway includes: Establishing a connection with a second terminal device and receiving a key sent by the second terminal device; after the key is generated by the protocol gateway, sending the key to the second terminal device; After receiving the key, disconnect the connection with the second terminal device and send a Bluetooth connection request to the protocol gateway, so that the protocol gateway receives the Bluetooth connection request sent by the first terminal device, responds to the Bluetooth connection request sent by the first terminal device, and establishes a Bluetooth connection with the first terminal device.

8. The communication method according to claim 7, characterized in that: The receiving the account information sent by the protocol gateway includes: Receiving the encrypted account information sent by the protocol gateway; the encrypted account information is obtained by encrypting the account information by the key after the protocol gateway determines the account information; The encrypted account information is decrypted according to the key to obtain the account information.

9. The communication method according to claim 6, characterized in that: The control command of the preset communication protocol is obtained by the protocol gateway acquiring control information sent by the server and converting the control information; the control information is sent to the server by the second terminal device.

10. A communication system, characterized in that: The system comprises: a protocol gateway and a first terminal device; The protocol gateway is used to establish a Bluetooth connection with a first terminal device; allocate account information to the first terminal device and send the account information to the first terminal device; disconnect the Bluetooth connection with the first terminal device; receive a connection request of a preset communication protocol sent by the first terminal device via Bluetooth broadcast; the connection request of the preset communication protocol includes the account information; respond to the connection request of the preset communication protocol, establish a communication connection of the preset communication protocol with the first terminal device according to the account information; send a control command of the preset communication protocol to the first terminal device via Bluetooth broadcast; The first terminal device is used to establish a Bluetooth connection with the protocol gateway; receive account information sent by the protocol gateway; disconnect the Bluetooth connection with the protocol gateway; send a connection request of a preset communication protocol to the protocol gateway via Bluetooth broadcast; obtain a control command of the preset communication protocol sent by the protocol gateway via Bluetooth broadcast, and respond to the control command of the preset communication protocol.

11. A communication device, characterized in that: The device is applied to a protocol gateway, and the device comprises: A first connection module, used to establish a Bluetooth connection with a first terminal device; A first sending module, configured to allocate account information to the first terminal device and send the account information to the first terminal device; A first disconnection module, used to disconnect the Bluetooth connection with the first terminal device; A first receiving module, configured to receive a connection request of a preset communication protocol sent by the first terminal device via Bluetooth broadcast; the connection request of the preset communication protocol includes the account information; A second connection module, configured to respond to a connection request of the preset communication protocol and establish a communication connection of the preset communication protocol with the first terminal device according to the account information; The second sending module is used to send the control command of the preset communication protocol to the first terminal device through Bluetooth broadcast, so that the first terminal device responds to the control command of the preset communication protocol after receiving the control command of the preset communication protocol.

12. A communication device, characterized in that: The device is applied to a first terminal, and includes: A third connection module, used to establish a Bluetooth connection with the protocol gateway; A second receiving module, configured to receive the account information sent by the protocol gateway; the account information is allocated by the protocol gateway to the first terminal device; A second disconnection module, used to disconnect the Bluetooth connection with the protocol gateway; A third sending module is used to send a connection request of a preset communication protocol to the protocol gateway via Bluetooth broadcast, so that the protocol gateway responds to the connection request of the preset communication protocol and establishes a communication connection of the preset communication protocol with the first terminal device according to the account information; the connection request of the preset communication protocol includes the account information; The acquisition module is used to acquire the control command of the preset communication protocol sent by the protocol gateway through Bluetooth broadcast, and respond to the control command of the preset communication protocol.

13. An electronic device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein when the computer program is executed by the processor, the steps of the communication method according to any one of claims 1 to 5 or 6 to 9 are implemented.

14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the communication method according to any one of claims 1 to 5 or 6 to 9 are implemented.