CN113271579A - Bluetooth device control method, client, computer device and readable storage medium - Google Patents
Bluetooth device control method, client, computer device and readable storage medium Download PDFInfo
- Publication number
- CN113271579A CN113271579A CN202110567546.5A CN202110567546A CN113271579A CN 113271579 A CN113271579 A CN 113271579A CN 202110567546 A CN202110567546 A CN 202110567546A CN 113271579 A CN113271579 A CN 113271579A
- Authority
- CN
- China
- Prior art keywords
- broadcast
- packet
- broadcast packet
- bluetooth
- bluetooth equipment
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W4/00—Services specially adapted for wireless communication networks; Facilities therefor
- H04W4/80—Services using short range communication, e.g. near-field communication [NFC], radio-frequency identification [RFID] or low energy communication
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W4/00—Services specially adapted for wireless communication networks; Facilities therefor
- H04W4/06—Selective distribution of broadcast services, e.g. multimedia broadcast multicast service [MBMS]; Services to user groups; One-way selective calling services
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D30/00—Reducing energy consumption in communication networks
- Y02D30/70—Reducing energy consumption in communication networks in wireless communication networks
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Multimedia (AREA)
- Mobile Radio Communication Systems (AREA)
Abstract
The application relates to a Bluetooth device control method, a client, a computer device and a readable storage medium, wherein the method comprises the following steps: acquiring distribution network information broadcasted by Bluetooth equipment; the distribution network information comprises identification information of the Bluetooth equipment, and the identification information is used for uniquely identifying the Bluetooth equipment; the Bluetooth equipment is distributed according to the distribution network information and is activated and registered to a cloud server; receiving a control instruction of a user, combining the control instruction and identification information of the Bluetooth equipment to generate a broadcast packet, and sending the broadcast packet in a broadcast mode, so that the Bluetooth equipment corresponding to the identification information executes control operation corresponding to the control instruction after receiving the broadcast packet, receives a response broadcast packet sent by the Bluetooth equipment, and returns data obtained after analyzing the response broadcast packet to a control panel. Through this application, solved through the higher and great problem of consumption of bluetooth controlgear cost.
Description
Technical Field
The present application relates to the field of communications technologies, and in particular, to a bluetooth device control method, a client, a computer device, and a readable storage medium.
Background
Along with the development of the internet of things, intelligent equipment is more and more popular, and a main stream is also formed through Bluetooth control equipment. Bluetooth is a short-distance wireless communication technology, and can realize data exchange between fixed equipment and mobile equipment. With the development of scientific technology, BLE (Bluetooth Low Energy) technology is widely applied to wireless communication scenes such as smart homes due to the characteristics of Low cost, short distance, interoperability and the like, and the product power consumption can be effectively reduced by using the BLE technology.
At present, the process of controlling the equipment through the Bluetooth is mainly the process of scanning, connecting and controlling the equipment. Although most control scenes are used in the solution, the chip is expensive due to chip manufacturing and cost, and has no competitive advantage in some cheap commodities.
At present, no effective solution is provided for the problems of higher cost and larger power consumption of the control equipment through the Bluetooth in the related technology.
Disclosure of Invention
The embodiment of the application provides a Bluetooth device control method, a client, a computer device and a readable storage medium, so as to at least solve the problems of higher cost and higher power consumption of a Bluetooth control device in the related art.
In a first aspect, an embodiment of the present application provides a bluetooth device control method, which is applied to a client, and the method includes:
acquiring distribution network information broadcasted by Bluetooth equipment; the distribution network information comprises identification information and an SSID (service set identifier), wherein the identification information is used for uniquely identifying the Bluetooth equipment;
the Bluetooth equipment is distributed according to the distribution network information, and is activated and registered to a cloud server;
receiving a control instruction of a user, combining the control instruction and the identification information of the Bluetooth equipment to generate a broadcast packet, and sending the broadcast packet in a broadcast mode, so that the Bluetooth equipment corresponding to the identification information executes the control operation corresponding to the control instruction after receiving the broadcast packet
The broadcast packet comprises a sub-packet flag bit, and the sub-packet flag bit is used for identifying whether sub-packets exist in the broadcast packet or not; the transmitting the broadcast packet in a broadcast manner includes:
determining a content length of the broadcast packet;
according to the content length and the preset length of the broadcast packet, performing packet processing on the broadcast packet to obtain at least two broadcast packets;
transmitting at least two of the broadcast packets in a cross-connection;
and receiving a response broadcast packet sent by the Bluetooth equipment, and returning data obtained by analyzing the response broadcast packet to a control panel.
In some embodiments, the configuring the bluetooth device according to the distribution network information and activating and registering to a cloud server includes:
uploading the distribution network information to a cloud server to complete the registration of the Bluetooth equipment in the cloud server;
acquiring broadcast decryption information, wherein the broadcast decryption information is generated by the cloud server responding to the distribution network information; the broadcast decryption information includes key information for communication with the bluetooth device; the key information comprises an encryption key and a corresponding decryption key;
and keeping receiving the Bluetooth broadcast in an opening state after the distribution network is successful.
In some embodiments, the receiving a control command of a user, combining the control command and the identification information of the bluetooth device to generate a broadcast packet, and transmitting the broadcast packet in a broadcast manner includes:
receiving a control instruction of a user;
encrypting the control instruction according to the encryption key;
and combining the encrypted control command and the identification information of the Bluetooth equipment to generate a broadcast packet, and sending the broadcast packet in a broadcast mode.
In some embodiments, the broadcast packet includes a packetization flag for identifying whether the broadcast packet is packetized; the transmitting the broadcast packet in a broadcast manner includes:
determining a content length of the broadcast packet;
according to the content length and a preset length, performing sub-packet processing on the broadcast packet to obtain at least two broadcast sub-packets;
at least two of the broadcast packets are cross-transmitted.
In a second aspect, an embodiment of the present application provides a bluetooth device control method, which is applied to a bluetooth device, and the method includes:
sending distribution network information to a client to indicate the client to complete distribution network between the Bluetooth device and a cloud server according to the distribution network information; the distribution network information comprises identification information and an SSID, and the identification information is used for uniquely identifying the Bluetooth equipment;
receiving a broadcast packet broadcasted by the client, wherein the broadcast packet is generated by combining a control instruction input by a user and the identification information of the Bluetooth equipment by the client;
analyzing the broadcast packet to obtain the control instruction and the identification information, and determining whether to execute the control operation corresponding to the control instruction according to the identification information;
and after the control operation corresponding to the control instruction is executed, generating a response broadcast packet, and broadcasting and sending the response broadcast packet to the client.
In some of these embodiments, the method further comprises:
when the Bluetooth equipment actively updates information, the updating information is encrypted through an encryption key to generate an updating broadcast packet; sending the updating broadcast packet to the client;
and after receiving the updating broadcast packet, the client decrypts the updating broadcast packet by adopting a corresponding decryption key to obtain decrypted data, and synchronizes the decrypted data to a control panel of the client.
In some embodiments, the bluetooth device further comprises, after receiving the broadcast packet broadcast by the client:
identifying the state of a sub-packet flag bit in the broadcast packet, and determining whether the broadcast packet is a broadcast sub-packet according to the state of the sub-packet flag bit;
if the broadcast packet is a broadcast sub-packet, acquiring the state of a sequence flag bit in the broadcast sub-packet;
and combining a plurality of broadcast sub-packets according to the state of the sequential flag bit of each broadcast sub-packet to obtain a complete broadcast packet.
In a third aspect, an embodiment of the present application provides a client, including: the device comprises an acquisition module, a distribution network module and a broadcast control module, wherein:
the acquisition module is used for acquiring the distribution network information broadcasted by the Bluetooth equipment; the distribution network information comprises identification information, and the identification information is used for uniquely identifying the Bluetooth equipment;
the distribution network module is used for distributing the network to the Bluetooth equipment according to the distribution network information and activating and registering the Bluetooth equipment to a cloud server;
the broadcast control module is used for receiving a control instruction of a user, combining the control instruction and the identification information of the Bluetooth equipment to generate a broadcast packet, and sending the broadcast packet in a broadcast mode so that the Bluetooth equipment corresponding to the identification information executes the control operation corresponding to the control instruction after receiving the broadcast packet;
the broadcast packet comprises a sub-packet flag bit, and the sub-packet flag bit is used for identifying whether sub-packets exist in the broadcast packet or not; the broadcast control module is further configured to: determining a content length of the broadcast packet; according to the content length and the preset length of the broadcast packet, performing packet processing on the broadcast packet to obtain at least two broadcast packets;
transmitting at least two of the broadcast packets in a cross-connection;
and the feedback module is used for receiving the response broadcast packet sent by the Bluetooth equipment and returning data obtained after analyzing the response broadcast packet to the control panel.
In a fourth aspect, an embodiment of the present application provides a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor implements the bluetooth device control method according to the first and second aspects when executing the computer program.
In a fifth aspect, the present application provides a computer-readable storage medium, on which a computer program is stored, which when executed by a processor implements the bluetooth device control method according to the first and second aspects.
Compared with the related art, the Bluetooth device control method provided by the embodiment of the application comprises the following steps: acquiring distribution network information of the Bluetooth equipment; the distribution network information comprises identification information, and the identification information is used for uniquely identifying the Bluetooth equipment; completing the network distribution between the Bluetooth equipment and a cloud server according to the network distribution information; the method comprises the steps of receiving a control instruction of a user, combining the control instruction and identification information of Bluetooth equipment to generate a broadcast packet, sending the broadcast packet in a broadcast mode, enabling the Bluetooth equipment corresponding to the identification information to execute control operation corresponding to the control instruction after receiving the broadcast packet, receiving a response broadcast packet sent by the Bluetooth equipment, and returning data obtained after analyzing the response broadcast packet to a control panel, so that the problems of high cost and large power consumption of the Bluetooth control equipment are solved.
The details of one or more embodiments of the application are set forth in the accompanying drawings and the description below to provide a more thorough understanding of the application.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
fig. 1 is a flowchart illustrating a method for controlling a bluetooth device by a client according to an embodiment of the present application;
fig. 2 is a flowchart of a bluetooth device control method implemented by a bluetooth device according to another embodiment of the present application;
fig. 3 is an overall interaction diagram of a bluetooth control method provided in an embodiment of the present application;
fig. 4 is a schematic structural diagram of a client provided in an embodiment of the present application;
fig. 5 is an internal structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be described and illustrated below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments provided in the present application without any inventive step are within the scope of protection of the present application.
Reference in the specification to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the specification. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those of ordinary skill in the art will explicitly and implicitly appreciate that the embodiments described herein may be combined with other embodiments without conflict.
Unless defined otherwise, technical or scientific terms referred to herein shall have the ordinary meaning as understood by those of ordinary skill in the art to which this application belongs. Reference to "a," "an," "the," and similar words throughout this application are not to be construed as limiting in number, and may refer to the singular or the plural. The present application is directed to the use of the terms "including," "comprising," "having," and any variations thereof, which are intended to cover non-exclusive inclusions; for example, a process, method, system, article, or apparatus that comprises a list of steps or modules (elements) is not limited to the listed steps or elements, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus. The term "plurality" as referred to herein means two or more. Reference herein to the terms "first," "second," "third," and the like, are merely to distinguish similar objects and do not denote a particular ordering for the objects.
The embodiment provides a Bluetooth device control method. Fig. 1 is a flowchart of a bluetooth device control method according to an embodiment of the present application, applied to a client, and as shown in fig. 1, the flowchart includes the following steps:
And 120, carrying out network distribution on the Bluetooth equipment according to the network distribution information, and activating and registering the Bluetooth equipment to a cloud server.
determining a content length of the broadcast packet;
according to the content length and the preset length of the broadcast packet, performing packet processing on the broadcast packet to obtain at least two broadcast packets;
at least two of the broadcast packets are cross-transmitted.
Conventionally, a bluetooth control device generally needs a chip for establishing a bluetooth channel, scans a received bluetooth broadcast sent by a bluetooth device through a bluetooth module based on a bluetooth protocol, identifies device information of the corresponding bluetooth device according to the received bluetooth broadcast, where the device information includes, but is not limited to, a device type, a device version, a device Mac address, and the like, establishes a bluetooth connection with the identified bluetooth device, and establishes a bluetooth channel between the control device and the bluetooth device. That is to say, when a device having a bluetooth module, for example, an intelligent luminaire, is not connected, a bluetooth broadcast is periodically transmitted, the control device scans the bluetooth broadcast around the control device through the bluetooth module, when the bluetooth broadcast of a new device is scanned, the device type, the device version, and the device Mac address of the bluetooth device corresponding to the bluetooth broadcast are identified, a bluetooth channel between the control device and the bluetooth device is established according to the received broadcast, and the control information transmitted by the control device is received through the bluetooth channel to execute a corresponding control operation. The method needs the Bluetooth equipment to send broadcast in the process of controlling the equipment through the Bluetooth, a client scans the broadcast of the Bluetooth equipment to establish Bluetooth connection, and the Bluetooth control is realized by receiving and sending data through the Bluetooth connection. However, on one hand, the method has the advantages that the chip price is high due to the chip manufacturing for establishing the Bluetooth connection, the cost and the like, and the competitive advantage is not provided for some commodities sensitive to the price; on the other hand, the bluetooth connection process is time consuming and may fail; and if the bluetooth equipment is connected all the time, the power consumption is higher.
According to the method and the device, the control instruction for controlling the Bluetooth equipment is broadcasted in the form of the broadcast packet, so that the Bluetooth equipment can be directly communicated with the client, a Bluetooth connection process is not needed, and the power consumption is lower because the Bluetooth equipment is not based on a ble protocol; in addition, an expensive chip is not needed, and the cost is reduced. And secondly, group control can be realized in the later period by controlling the Bluetooth equipment in a mode of broadcasting the broadcast packet by the client, and the expansibility is better on the basis of low cost.
In addition, the broadcast packet in the application is generated by combining the client according to the control instruction and the identification information of the Bluetooth device to be controlled, so that the devices of the same type can be prevented from executing control operation after receiving the broadcast packet. The combination may be that one or more bytes in the broadcast packet are predefined to represent the control command, and the identification information may be placed in the header or other bytes of the broadcast packet. Specifically, after the bluetooth devices of the same type receive the broadcast packet, one of the methods is as follows: firstly, the identification information of the head is obtained to judge whether the identification information is matched with the head. And if the Bluetooth control command is matched with the Bluetooth control command, further analyzing the broadcast packet, acquiring the Bluetooth control command, and executing the control operation corresponding to the control command. Another way is: and directly analyzing the broadcast packet to obtain the identification information and the control instruction of the Bluetooth equipment, and determining whether to execute the control instruction or not through the identification information.
In this application, bluetooth equipment can be intelligent equipment such as intelligent lamps and lanterns, intelligent TV, refrigerator. The client may include one or more of a Personal Computer (PC), a tablet, a smart phone, and a wireless terminal. The client side can be provided with a control APP, preferably, a control instruction of a user is received through the APP, the control instruction and the identification information of the Bluetooth device are combined to generate a broadcast packet, and the broadcast packet is sent in a broadcast mode.
According to the method and the device, the response broadcast packet sent by the Bluetooth equipment is received, and the data obtained after the response broadcast packet is analyzed is returned to the control panel. And establishing broadcast communication through the client, and after sending out the broadcast packet, receiving the broadcast and keeping in an open state all the time. After the Bluetooth device triggers corresponding behaviors according to the received control instruction, a response broadcast packet is generated, and the control is replied successfully. And after receiving the response broadcast packet, the client analyzes the response broadcast packet to obtain response data, and returns the response data to the client panel. Through the bidirectional interaction process between the client and the Bluetooth device, the client can definitely know whether the sent control command is effectively executed or not. Further, if the response broadcast packet is not received within the preset time, the broadcast packet may be retransmitted to ensure that the bluetooth device may receive the broadcast packet. The Bluetooth device only executes the control instruction contained in the first broadcast packet to the same broadcast packet received within the preset time, and improves the accuracy of control over the Bluetooth device while improving the receiving of the broadcast packet by the Bluetooth device.
The method comprises the steps that a broadcast packet generated by a client comprises a sub-packet zone bit, and the sub-packet zone bit is used for identifying whether the broadcast packet has sub-packets or not; the transmitting the broadcast packet in a broadcast manner includes:
determining a content length of the broadcast packet;
according to the content length and a preset length, performing sub-packet processing on the broadcast packet to obtain at least two broadcast sub-packets;
at least two of the broadcast packets are cross-transmitted.
The iOS handset sends the broadcast with a format limitation on the length of the field, which must be 16bits or 128 bits. There may be LocalName and Service id fields in the broadcast packet. If the LocalName field is used alone, the length limit of the LocalName of the apple-phone is too short, and all information cannot be stored, so the embodiment splits the broadcast content into the LocalName and Service id. The Bluetooth broadcast generated by the client is divided into two parts of data, namely LocalName and Service id. The LocalName group is used for storing device identification information, such as a mac address, and is used for indicating a broadcast sent to which bluetooth device, and the Service id part is mainly used for transmitting a control instruction. The Service id also stores the version number, the command, the self-increment number, the sub-package and parameter and the broadcast crc operation. The commands comprise distribution network command reporting, network access success command reporting, unbinding command issuing, control command reporting and control command issuing.
According to the above description, in order to improve the communication efficiency, the LocalName part data is not encrypted, and the Service id part data is broadcasted after being encrypted by using the encryption key.
In addition, sometimes, due to the limitation of the length of the broadcast content, the content of the complete broadcast packet is too long and needs to be sent in a sub-packet mode, and according to the length of the content and the preset length, the broadcast packet is subjected to sub-packet processing to obtain at least two broadcast sub-packets, and the broadcast sub-packets are sent in a cross mode.
Cross-forwarding may be understood as cross-forwarding a plurality of broadcast packets to a bluetooth device, i.e. at least two broadcast packets are sent in turn. For example, the client needs to send a command to the bluetooth device once, but because the data packet is too long, the data packet is divided into two broadcast packets, p1 and p2, and then sent 10 times first p1, 10 times later p2, 10 times later p1, and 10 times later p2, so as to ensure that the bluetooth device receives the broadcast packet. It will be appreciated that the bluetooth device processes the data received only once, ignoring other duplicate data to ensure accurate control. The number of the client relapses may also be other values, such as 5, 6, 8, etc., and is not particularly limited.
In some embodiments, the configuring the bluetooth device according to the distribution network information and activating and registering to a cloud server includes:
uploading the distribution network information to a cloud server to complete the registration of the Bluetooth equipment in the cloud server;
acquiring broadcast decryption information, wherein the broadcast decryption information is generated by the cloud server responding to the distribution network information; the broadcast decryption information includes key information for communication with the bluetooth device; the key information comprises an encryption key and a corresponding decryption key;
and keeping receiving the Bluetooth broadcast in an opening state after the distribution network is successful.
After scanning a broadcast packet containing distribution network information sent by the bluetooth device in the initial state, the client acquires basic information of the bluetooth device, including but not limited to a Mac address, parameters, UUID, and the like of the bluetooth device. The Bluetooth authority is started, meanwhile, the Bluetooth equipment is distributed with a network, the distribution network information is uploaded to a cloud server, and the characteristic information generated by a cloud server is returned to the Bluetooth equipment after registration is activated, wherein the characteristic information comprises equipment information, an equipment communication encryption and decryption key and the like. After the distribution network is successful, the client and the equipment receive the broadcast and are always in an open state, so that the broadcast packet can be received.
The method comprises the following steps that a client receives a control instruction of a user, combines the control instruction with identification information of the Bluetooth equipment to generate a broadcast packet, and sends the broadcast packet in a broadcast mode, and the method comprises the following steps:
and receiving a control instruction of a user. The user can send the control instruction by triggering the control panel, and can also send the control instruction by a voice or text input mode. The specific manner is not limited.
Encrypting the control instruction according to an encryption key generated by the cloud server;
and combining the encrypted control command and the identification information of the Bluetooth equipment to generate a broadcast packet, and sending the broadcast packet in a broadcast mode.
The specific control process for the bluetooth device is as follows:
and after the client panel triggers the control command, the client encrypts the control command through the encryption key, puts the encrypted control command and the Mac address into a broadcast packet, and sends the broadcast through the client. The Bluetooth equipment receives a broadcast packet sent by a client within a certain range, and matches the instruction to be processed with the Mac address according to whether the instruction needs to be processed or not. The control instructions are processed by a decryption key in the bluetooth device. And triggering corresponding behaviors through the decrypted control instruction and returning the responded instruction to the client through the encryption key. The client receives the device broadcast packet and returns the data analyzed by the decryption key to the client panel.
In other embodiments, matching whether an instruction needs to be processed by Mac address includes at least the following two cases: (1) in the broadcast packet, the identification information of the Bluetooth device is placed in a plaintext byte, and the data of the byte is not encrypted. The control instruction part is arranged in the ciphertext byte, and the data of the byte is encrypted through the encryption key. After receiving the broadcast packet, the bluetooth device may first obtain the identification information from the plaintext byte portion, which is described in this application taking the identification information as the Mac address as an example. If the identification information is matched with the self information, the ciphertext part is further decrypted through the decryption key to obtain a control instruction, and the operation corresponding to the control instruction is executed. (2) All data in the broadcast packet are encrypted by using the encryption key, and after receiving the broadcast packet, the Bluetooth device decrypts the broadcast packet by using the corresponding decryption key to obtain the identification information and the control instruction. And determining whether the control instruction needs to be executed according to the identification information. Through encrypting the broadcast packet, can promote bluetooth control's security. In the present application, the first method is adopted, and only the control command is encrypted.
In some embodiments, the packetization flag bit may be located in a plaintext portion of the broadcast packet, and the client does not encrypt data of the flag bit, so that the communication duration may be reduced.
The embodiment also provides a bluetooth device control method, which is applied to a bluetooth device, and as shown in fig. 2, the process includes the following steps:
According to the Bluetooth control method, the control instruction for controlling the Bluetooth equipment is broadcast in the form of the broadcast packet, so that the Bluetooth equipment can be directly communicated with the client, a Bluetooth connection process is not needed, and the Bluetooth control method is not based on a ble protocol and has lower power consumption; in addition, an expensive chip is not needed, and the cost is reduced. And secondly, group control can be realized in the later period by controlling the Bluetooth equipment in a mode of broadcasting the broadcast packet by the client, and the expansibility is better on the basis of low cost.
In some of these embodiments, the method further comprises:
when the Bluetooth equipment actively updates information, the updating information is encrypted through an encryption key to generate an updating broadcast packet; sending the updating broadcast packet to the client;
and after receiving the updating broadcast packet, the client decrypts the updating broadcast packet by adopting a corresponding decryption key to obtain decrypted data, and synchronizes the decrypted data to a control panel of the client.
Since the control instruction is sent and then the control broadcast is relied on, the client state change in the application can be returned without depending on the device state for the user experience. The state of the equipment is actively synchronized, and the client does not need to send broadcast to inform the Bluetooth equipment after receiving the message, so that the synchronous control is realized.
The bluetooth device further comprises, after receiving the broadcast packet broadcasted by the client:
identifying the state of a sub-packet flag bit in the broadcast packet, and determining whether the broadcast packet is a broadcast sub-packet according to the state of the sub-packet flag bit;
if the broadcast packet is a broadcast sub-packet, acquiring the state of a sequence flag bit in the broadcast sub-packet;
and combining a plurality of broadcast sub-packets according to the state of the sequential flag bit of each broadcast sub-packet to obtain a complete broadcast packet.
Specifically, the bluetooth device judges whether the packet data is stored according to the packet flag bit in the service id. The state of the packetization flag may be specifically a number, for example, 0 indicates that it is not a broadcast packet, and 1 indicates that it is a broadcast packet. If the broadcast sub-packets exist, the Bluetooth equipment performs combination according to the receiving sequence of the broadcast packets. The broadcast packet contains SN bytes which are used as beacon frame serial numbers and occupy 4 bytes, the device resets each time and returns to zero, and the SN value is added with 1 when a different broadcast packet is sent each time; the SN remains consistent with each retransmission or forwarding. If the SN is not 0 or is sub-packaged, the broadcast is known to be terminated when the SN is 0 in the last packet, the sequence of the broadcast sub-packages can be known according to the SN, and the broadcast sub-packages are combined according to the sequence to obtain a complete broadcast packet.
For better explanation of the bluetooth device control method provided in the present application, refer to the interaction diagram of fig. 3.
After a client (including but not limited to a mobile phone, a tablet, a computer, etc.) scans a bluetooth device (hereinafter referred to as "device") which is in an initial state and sends out distribution network broadcast, basic information of the device is acquired. (including but not limited to Mac addresses, parameters, UUIDs, etc.). The Bluetooth permission is opened, the equipment is distributed, the broadcast information is uploaded to the cloud end, and the characteristic information is returned to the equipment end after registration is activated, such as equipment information, equipment communication encryption and decryption keys and the like. After the distribution network is successful, the client and the equipment end receive the broadcast and are always in an open state. After the client panel triggers the control command, the client encrypts the control command through the encryption key, puts the encrypted control command and the Mac address into a broadcast packet, and sends the broadcast through the client. The device receives the broadcast packet sent by the client within a certain range, and matches the instruction to be processed with the Mac address according to whether the instruction is the instruction to be processed or not. The device instructions are processed by a decryption key in the device. And triggering corresponding behaviors through the decrypted device instruction and returning the responded instruction to the client through the encrypted key. And the client receives the device broadcast packet and returns the data analyzed by the decryption key to the client panel. And when the equipment actively updates the information, the broadcast packet is sent after the encryption by the encryption key. And after receiving the broadcast, the client analyzes the data through the decryption key and synchronizes the information to the client panel.
It should be noted that the steps illustrated in the above-described flow diagrams or in the flow diagrams of the figures may be performed in a computer system, such as a set of computer-executable instructions, and that, although a logical order is illustrated in the flow diagrams, in some cases, the steps illustrated or described may be performed in an order different than here.
The present embodiment further provides a client, where the apparatus is configured to implement the foregoing embodiments and preferred embodiments, and details of which have been already described are omitted. As used hereinafter, the terms "module," "unit," "subunit," and the like may implement a combination of software and/or hardware for a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated.
Fig. 4 is a block diagram of a client according to an embodiment of the present application, and as shown in fig. 4, the client includes: an acquisition module 410, a distribution network module 420, a broadcast control module 430, and a feedback module 440, wherein:
the acquisition module 410 is used for acquiring distribution network information broadcasted by the bluetooth device; the distribution network information comprises identification information of Bluetooth equipment, and the identification information is used for uniquely identifying the Bluetooth equipment;
the distribution network module 420 is used for distributing a network for the Bluetooth equipment according to the distribution network information and activating and registering the Bluetooth equipment to the cloud server;
a broadcast control module 430, configured to receive a control instruction of a user, combine the control instruction and the identification information of the bluetooth device to generate a broadcast packet, and send the broadcast packet in a broadcast manner, so that the bluetooth device corresponding to the identification information executes a control operation corresponding to the control instruction after receiving the broadcast packet; the broadcast packet comprises a sub-packet flag bit, and the sub-packet flag bit is used for identifying whether sub-packets exist in the broadcast packet or not; the broadcast control module is further configured to: determining a content length of the broadcast packet; according to the content length and the preset length of the broadcast packet, performing packet processing on the broadcast packet to obtain at least two broadcast packets;
transmitting at least two of the broadcast packets in a cross-connection;
the feedback module 440 is configured to receive a response broadcast packet sent by the bluetooth device, and return data obtained by parsing the response broadcast packet to the control panel.
The client side broadcasts the control command for controlling the Bluetooth equipment in a broadcast packet mode, so that the Bluetooth equipment can be directly communicated with the client side, a Bluetooth connection process is not needed, a ble protocol is not needed, and the power consumption is lower; in addition, an expensive chip is not needed, and the cost is reduced. And secondly, group control can be realized in the later period by controlling the Bluetooth equipment in a mode of broadcasting the broadcast packet by the client, and the expansibility is better on the basis of low cost.
The above modules may be functional modules or program modules, and may be implemented by software or hardware. For a module implemented by hardware, the modules may be located in the same processor; or the modules can be respectively positioned in different processors in any combination.
In addition, the bluetooth device control method described in the embodiment of the present application with reference to fig. 1 and 2 may be implemented by a computer device. Fig. 5 is a hardware structure diagram of a computer device according to an embodiment of the present application.
The computer device may comprise a processor 51 and a memory 52 in which computer program instructions are stored.
Specifically, the processor 51 may include a Central Processing Unit (CPU), or A Specific Integrated Circuit (ASIC), or may be configured to implement one or more Integrated circuits of the embodiments of the present Application.
The memory 52 may be used to store or cache various data files for processing and/or communication use, as well as possibly computer program instructions for execution by the processor 52.
The processor 51 realizes any of the bluetooth device control methods in the above embodiments by reading and executing computer program instructions stored in the memory 52.
In some of these embodiments, the computer device may also include a communication interface 53 and a bus 50. As shown in fig. 5, the processor 51, the memory 52, and the communication interface 53 are connected via the bus 50 to complete mutual communication.
The communication interface 53 is used for implementing communication between modules, apparatuses, units and/or devices in the embodiments of the present application. The communication interface 53 may also enable communication with other components such as: the data communication is carried out among external equipment, image/data acquisition equipment, a database, external storage, an image/data processing workstation and the like.
The computer device may execute the bluetooth device control method in the embodiment of the present application based on the acquired program instruction, thereby implementing the bluetooth device control method described in conjunction with fig. 1 and 2.
In addition, in combination with the bluetooth device control method in the foregoing embodiments, the embodiments of the present application may be implemented by providing a computer-readable storage medium. The computer readable storage medium having stored thereon computer program instructions; the computer program instructions, when executed by a processor, implement any of the bluetooth device control methods in the above embodiments.
The technical features of the embodiments described above may be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the embodiments described above are not described, but should be considered as being within the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.
Claims (9)
1. A Bluetooth device control method is applied to a client side, and comprises the following steps:
acquiring distribution network information broadcasted by Bluetooth equipment; the distribution network information comprises identification information of the Bluetooth equipment, and the identification information is used for uniquely identifying the Bluetooth equipment;
the Bluetooth equipment is distributed according to the distribution network information, and is activated and registered to a cloud server;
receiving a control instruction of a user, combining the control instruction and the identification information of the Bluetooth equipment to generate a broadcast packet, and sending the broadcast packet in a broadcast mode, so that the Bluetooth equipment corresponding to the identification information executes the control operation corresponding to the control instruction after receiving the broadcast packet;
the broadcast packet comprises a sub-packet flag bit, and the sub-packet flag bit is used for identifying whether sub-packets exist in the broadcast packet or not; the transmitting the broadcast packet in a broadcast manner includes:
determining a content length of the broadcast packet;
according to the content length and the preset length of the broadcast packet, performing packet processing on the broadcast packet to obtain at least two broadcast packets;
transmitting at least two of the broadcast packets in a cross-connection;
and receiving a response broadcast packet sent by the Bluetooth equipment, and returning data obtained by analyzing the response broadcast packet to a control panel.
2. The method of claim 1, wherein the network distribution of the Bluetooth device according to the network distribution information and the activation registration to a cloud server comprise:
uploading the distribution network information to a cloud server to complete the registration of the Bluetooth equipment in the cloud server;
acquiring broadcast decryption information, wherein the broadcast decryption information is generated by the cloud server responding to the distribution network information; the broadcast decryption information includes key information for communication with the bluetooth device; the key information comprises an encryption key and a corresponding decryption key;
and keeping receiving the Bluetooth broadcast in an opening state after the distribution network is successful.
3. The method of claim 2, wherein the receiving a control command from a user, combining the control command with identification information of the bluetooth device to generate a broadcast packet, and transmitting the broadcast packet in a broadcast manner comprises:
receiving a control instruction of a user;
encrypting the control instruction according to the encryption key;
and combining the encrypted control command and the identification information of the Bluetooth equipment to generate a broadcast packet, and sending the broadcast packet in a broadcast mode.
4. A Bluetooth device control method is applied to a Bluetooth device, and comprises the following steps:
sending distribution network information to a client to indicate the client to complete distribution network between the Bluetooth device and a cloud server according to the distribution network information; the distribution network information comprises identification information, and the identification information is used for uniquely identifying the Bluetooth equipment;
receiving a broadcast packet broadcasted by the client, wherein the broadcast packet is generated by combining a control instruction input by a user and the identification information of the Bluetooth equipment by the client;
analyzing the broadcast packet to obtain the control instruction and the identification information, and determining whether to execute the control operation corresponding to the control instruction according to the identification information;
and after the control operation corresponding to the control instruction is executed, generating a response broadcast packet, and broadcasting and sending the response broadcast packet to the client.
5. The method of claim 4, further comprising:
when the Bluetooth equipment actively updates information, the updating information is encrypted through an encryption key to generate an updating broadcast packet; sending the updating broadcast packet to the client;
and after receiving the updating broadcast packet, the client decrypts the updating broadcast packet by adopting a corresponding decryption key to obtain decrypted data, and synchronizes the decrypted data to a control panel of the client.
6. The method of claim 4, wherein the Bluetooth device further comprises, after receiving the broadcast packet broadcast by the client:
identifying the state of a sub-packet flag bit in the broadcast packet, and determining whether the broadcast packet is a broadcast sub-packet according to the state of the sub-packet flag bit;
if the broadcast packet is a broadcast sub-packet, acquiring the state of a sequence flag bit in the broadcast sub-packet;
and combining a plurality of broadcast sub-packets according to the state of the sequential flag bit of each broadcast sub-packet to obtain a complete broadcast packet.
7. A client, comprising: the device comprises an acquisition module, a distribution network module and a broadcast control module, wherein:
the acquisition module is used for acquiring the distribution network information broadcasted by the Bluetooth equipment; the distribution network information comprises identification information of Bluetooth equipment, and the identification information is used for uniquely identifying the Bluetooth equipment;
the distribution network module is used for distributing the network to the Bluetooth equipment according to the distribution network information and activating and registering the Bluetooth equipment to a cloud server;
the broadcast control module is used for receiving a control instruction of a user, combining the control instruction and the identification information of the Bluetooth equipment to generate a broadcast packet, and sending the broadcast packet in a broadcast mode so that the Bluetooth equipment corresponding to the identification information executes the control operation corresponding to the control instruction after receiving the broadcast packet;
the broadcast packet comprises a sub-packet flag bit, and the sub-packet flag bit is used for identifying whether sub-packets exist in the broadcast packet or not; the broadcast control module is further configured to: determining a content length of the broadcast packet; according to the content length and the preset length of the broadcast packet, performing packet processing on the broadcast packet to obtain at least two broadcast packets;
transmitting at least two of the broadcast packets in a cross-connection;
and the feedback module is used for receiving the response broadcast packet sent by the Bluetooth equipment and returning data obtained after analyzing the response broadcast packet to the control panel.
8. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the bluetooth device control method according to any one of claims 1 to 6 when executing the computer program.
9. A computer-readable storage medium on which a computer program is stored, characterized in that the program, when executed by a processor, implements the bluetooth device control method according to any one of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110567546.5A CN113271579B (en) | 2021-05-24 | 2021-05-24 | Bluetooth device control method, client, computer device and readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110567546.5A CN113271579B (en) | 2021-05-24 | 2021-05-24 | Bluetooth device control method, client, computer device and readable storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113271579A true CN113271579A (en) | 2021-08-17 |
CN113271579B CN113271579B (en) | 2022-10-11 |
Family
ID=77232621
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110567546.5A Active CN113271579B (en) | 2021-05-24 | 2021-05-24 | Bluetooth device control method, client, computer device and readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113271579B (en) |
Cited By (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114120611A (en) * | 2021-11-15 | 2022-03-01 | 深圳天元羲王材料科技有限公司 | Synchronous control method of graphene powder machine |
CN114463879A (en) * | 2022-01-25 | 2022-05-10 | 杭州涂鸦信息技术有限公司 | Unlocking method, intelligent terminal and computer readable storage medium |
CN114785628A (en) * | 2022-03-11 | 2022-07-22 | 杭州博联智能科技股份有限公司 | Whole-house intelligent equipment group control method, electronic equipment and medium |
CN114979974A (en) * | 2022-04-13 | 2022-08-30 | 深圳市智岩科技有限公司 | Wireless control method, device and equipment |
CN115065691A (en) * | 2022-08-18 | 2022-09-16 | 飞天诚信科技股份有限公司 | Communication implementation method and device based on android platform |
CN115174302A (en) * | 2022-09-06 | 2022-10-11 | 杭州涂鸦信息技术有限公司 | Processing method, device, equipment and storage medium of pluggable accessory |
CN115334486A (en) * | 2022-10-18 | 2022-11-11 | 成都锐成芯微科技股份有限公司 | Bluetooth communication method and Bluetooth system |
CN115396247A (en) * | 2022-08-24 | 2022-11-25 | 杭州涂鸦信息技术有限公司 | Network distribution method, device and system of Matter equipment |
CN115426210A (en) * | 2022-08-19 | 2022-12-02 | 珠海格力电器股份有限公司 | Equipment control method, device and system |
WO2023284870A1 (en) * | 2021-07-15 | 2023-01-19 | 海信视像科技股份有限公司 | Control method and control device |
WO2023227128A1 (en) * | 2022-05-27 | 2023-11-30 | 阿里云计算有限公司 | Bluetooth-based communication method and apparatus |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2014175602A1 (en) * | 2013-04-23 | 2014-10-30 | Samsung Electronics Co., Ltd. | Electronic device and method of registering personal cloud apparatus in user portal server thereof |
US20170094587A1 (en) * | 2015-09-28 | 2017-03-30 | Xiaomi Inc. | Message transmission method, message reception method and apparatus and storage medium |
CN106911761A (en) * | 2017-01-11 | 2017-06-30 | 深圳酷宅科技有限公司 | A kind of bluetooth equipment control method and system based on iBeacon |
CN109842667A (en) * | 2017-11-29 | 2019-06-04 | 北京京东尚科信息技术有限公司 | Method and cloud platform system for cloud platform management smart machine |
CN110691332A (en) * | 2019-09-17 | 2020-01-14 | 湖南简成信息技术有限公司 | Data processing method, device and storage medium based on Bluetooth broadcast |
CN110798795A (en) * | 2019-09-20 | 2020-02-14 | 广汽蔚来新能源汽车科技有限公司 | Virtual key vehicle control system, method and device based on Bluetooth and computer equipment |
CN111586590A (en) * | 2020-05-21 | 2020-08-25 | 四川虹美智能科技有限公司 | Method, device and system for distributing network to equipment |
US20200359209A1 (en) * | 2018-01-29 | 2020-11-12 | Fengping ZHAO | Method and system for Bluetooth-based multi-end to multi-end communication |
-
2021
- 2021-05-24 CN CN202110567546.5A patent/CN113271579B/en active Active
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2014175602A1 (en) * | 2013-04-23 | 2014-10-30 | Samsung Electronics Co., Ltd. | Electronic device and method of registering personal cloud apparatus in user portal server thereof |
US20170094587A1 (en) * | 2015-09-28 | 2017-03-30 | Xiaomi Inc. | Message transmission method, message reception method and apparatus and storage medium |
CN106911761A (en) * | 2017-01-11 | 2017-06-30 | 深圳酷宅科技有限公司 | A kind of bluetooth equipment control method and system based on iBeacon |
CN109842667A (en) * | 2017-11-29 | 2019-06-04 | 北京京东尚科信息技术有限公司 | Method and cloud platform system for cloud platform management smart machine |
US20200359209A1 (en) * | 2018-01-29 | 2020-11-12 | Fengping ZHAO | Method and system for Bluetooth-based multi-end to multi-end communication |
CN110691332A (en) * | 2019-09-17 | 2020-01-14 | 湖南简成信息技术有限公司 | Data processing method, device and storage medium based on Bluetooth broadcast |
CN110798795A (en) * | 2019-09-20 | 2020-02-14 | 广汽蔚来新能源汽车科技有限公司 | Virtual key vehicle control system, method and device based on Bluetooth and computer equipment |
CN111586590A (en) * | 2020-05-21 | 2020-08-25 | 四川虹美智能科技有限公司 | Method, device and system for distributing network to equipment |
Cited By (14)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2023284870A1 (en) * | 2021-07-15 | 2023-01-19 | 海信视像科技股份有限公司 | Control method and control device |
CN114120611A (en) * | 2021-11-15 | 2022-03-01 | 深圳天元羲王材料科技有限公司 | Synchronous control method of graphene powder machine |
CN114463879A (en) * | 2022-01-25 | 2022-05-10 | 杭州涂鸦信息技术有限公司 | Unlocking method, intelligent terminal and computer readable storage medium |
CN114785628A (en) * | 2022-03-11 | 2022-07-22 | 杭州博联智能科技股份有限公司 | Whole-house intelligent equipment group control method, electronic equipment and medium |
CN114979974A (en) * | 2022-04-13 | 2022-08-30 | 深圳市智岩科技有限公司 | Wireless control method, device and equipment |
WO2023227128A1 (en) * | 2022-05-27 | 2023-11-30 | 阿里云计算有限公司 | Bluetooth-based communication method and apparatus |
CN115065691B (en) * | 2022-08-18 | 2022-11-01 | 飞天诚信科技股份有限公司 | Communication implementation method and device based on android platform |
CN115065691A (en) * | 2022-08-18 | 2022-09-16 | 飞天诚信科技股份有限公司 | Communication implementation method and device based on android platform |
CN115426210A (en) * | 2022-08-19 | 2022-12-02 | 珠海格力电器股份有限公司 | Equipment control method, device and system |
CN115426210B (en) * | 2022-08-19 | 2024-02-09 | 珠海格力电器股份有限公司 | Equipment control method, device and system |
CN115396247A (en) * | 2022-08-24 | 2022-11-25 | 杭州涂鸦信息技术有限公司 | Network distribution method, device and system of Matter equipment |
CN115396247B (en) * | 2022-08-24 | 2023-12-19 | 杭州涂鸦信息技术有限公司 | Distribution network method, device and system of Matter equipment |
CN115174302A (en) * | 2022-09-06 | 2022-10-11 | 杭州涂鸦信息技术有限公司 | Processing method, device, equipment and storage medium of pluggable accessory |
CN115334486A (en) * | 2022-10-18 | 2022-11-11 | 成都锐成芯微科技股份有限公司 | Bluetooth communication method and Bluetooth system |
Also Published As
Publication number | Publication date |
---|---|
CN113271579B (en) | 2022-10-11 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN113271579B (en) | Bluetooth device control method, client, computer device and readable storage medium | |
US9338130B2 (en) | Apparatus and method to register Wi-Fi clients on a Wi-Fi network | |
EP2887587B1 (en) | Methods for transmitting and receiving information and associated internet of thing apparatus | |
US8094822B2 (en) | Broadcast encryption key distribution system | |
RU2648586C2 (en) | Methods, devices, and computer program products for device-to-device communication among wireless communication devices | |
US11647388B2 (en) | Method, control terminal and system for accessing device to network | |
WO2017213971A1 (en) | Network-visitability detection control | |
US10448230B2 (en) | Data transmission | |
CN110249585B (en) | Apparatus and method for information request and/or information provision | |
CN109309650B (en) | Data processing method, terminal equipment and network equipment | |
CN104137618A (en) | Shared network access via a peer-to-peer link | |
JP5239123B2 (en) | Wireless LAN system | |
WO2018094677A1 (en) | Bluetooth low energy (ble) device, and data update system and method | |
US20230224701A1 (en) | Network connection method, terminal, device to be connected to network, and storage medium | |
WO2005125089A1 (en) | System, method and computer program product for authenticating a data source in multicast communications | |
CN113595964A (en) | Connection tracking synchronization method, device, medium and equipment | |
WO2022174827A1 (en) | Multicast or broadcast service data security protection method and apparatus | |
US7623666B2 (en) | Automatic setting of security in communication network system | |
US10560436B2 (en) | Pseudonymous proximity location device | |
EP3355546B1 (en) | Device identification encryption | |
CN110830421A (en) | Data transmission method and device | |
KR102023416B1 (en) | Network switch and method for setting encryption section in data link layer using the same | |
US11146653B2 (en) | Method, data sending control server, storage server, processing server and system for sending data to at least one device | |
US20140344568A1 (en) | Server node discovery mechanism applied in cloud envionment capable of searching server node within cloud service cluster | |
CN115175110B (en) | Method and system for rapidly distributing network for equipment based on multicast |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |