[go: up one dir, main page]

CN117793681A - Bluetooth communication management method, system, storage medium and integrated gateway - Google Patents

Bluetooth communication management method, system, storage medium and integrated gateway Download PDF

Info

Publication number
CN117793681A
CN117793681A CN202311831124.XA CN202311831124A CN117793681A CN 117793681 A CN117793681 A CN 117793681A CN 202311831124 A CN202311831124 A CN 202311831124A CN 117793681 A CN117793681 A CN 117793681A
Authority
CN
China
Prior art keywords
connection
bluetooth
unique identification
target
handle
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.)
Pending
Application number
CN202311831124.XA
Other languages
Chinese (zh)
Inventor
钟第富
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen H&T Intelligent Control Co Ltd
Original Assignee
Shenzhen H&T Intelligent Control Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen H&T Intelligent Control Co Ltd filed Critical Shenzhen H&T Intelligent Control Co Ltd
Priority to CN202311831124.XA priority Critical patent/CN117793681A/en
Publication of CN117793681A publication Critical patent/CN117793681A/en
Pending legal-status Critical Current

Links

Landscapes

  • Mobile Radio Communication Systems (AREA)

Abstract

The invention discloses a Bluetooth communication management method, a system, a storage medium and a comprehensive gateway, wherein the comprehensive gateway can automatically discover which Bluetooth devices around are online and need to be reported through scanning broadcast Bluetooth devices, and equipment information does not need to be manually added. Then, the cloud server informs the comprehensive gateway of which devices need to be connected through the connection instruction, and the Bluetooth devices are sequentially connected with the target connection devices based on the unique identification codes in the connection instruction, so that the problems that repeated trial and error is very time-consuming and manual data addition is very complicated are avoided, quick automatic connection can be realized, and the efficiency is effectively improved.

Description

Bluetooth communication management method, system, storage medium and integrated gateway
Technical Field
The present invention relates to the field of bluetooth communication technologies, and in particular, to a bluetooth communication management method, system, storage medium, and integrated gateway.
Background
The integrated gateway is a party capable of actively initiating a bluetooth connection, and the bluetooth device is a party waiting for the bluetooth connection passively. With the increasing number of home bluetooth smart devices, users have increasingly required simultaneous communication between an integrated gateway and multiple bluetooth devices.
In the prior art, the storage system of the integrated gateway stores data of a plurality of bluetooth devices in advance, and the user can configure the connection sequence in advance based on the stored data. When one-to-many communication is performed, the comprehensive gateway sequentially sends out Bluetooth connection requests to the surrounding based on the pre-configured connection sequence, and if the corresponding Bluetooth equipment is broadcasting, the comprehensive gateway is successfully connected with the Bluetooth equipment and jumps to the request for sending Bluetooth connection to the next Bluetooth equipment; if the corresponding bluetooth device is not broadcasting (for example, is shut down, or is far away), the integrated gateway cannot connect with the bluetooth device, and after repeated requests and failure, the integrated gateway jumps to a request for sending bluetooth connection to the next bluetooth device until bluetooth connection cannot be established with the new bluetooth device. After the connection is completed, the integrated gateway updates the associated data to the storage system. This approach is often time consuming because of repeated mistakes, and once a newly added bluetooth device is present, the user also needs to re-manually add its data to the storage system, which is also cumbersome.
Disclosure of Invention
Based on this, it is necessary to provide a bluetooth communication management method, apparatus, medium and device, so as to solve the problem that the prior art is very time-consuming and cumbersome.
A bluetooth communication management method applied to a comprehensive gateway operating in a bluetooth master mode, the method comprising:
scanning Bluetooth equipment currently broadcasting, determining unique identification codes to be reported based on connection feedback data sent by all scanned Bluetooth equipment, and reporting all the unique identification codes to be reported to a cloud server; wherein the bluetooth device operates in a bluetooth slave mode;
monitoring and receiving a connection instruction sent by the cloud server; the connection instruction comprises the number of to-be-connected Bluetooth devices to be connected and unique identification codes of each designated Bluetooth device to be connected, wherein the number of to-be-connected Bluetooth devices to be connected is smaller than or equal to the number of reported unique identification codes;
transmitting a connection request to target connection equipment based on the unique identification code in the connection instruction, and enabling the current connection quantity to be +1 after Bluetooth connection is established with the target connection equipment; the target connection device is any one of all Bluetooth devices to be connected, and the initial value of the current connection quantity is 0;
and if the current connection quantity is smaller than the to-be-connected quantity, returning to execute the step and the subsequent steps of sending the connection request to the target connection equipment based on the unique identification code in the connection instruction until the current connection quantity is equal to the to-be-connected quantity.
In one embodiment, the determining the unique identifier code to be reported based on connection feedback data sent by all scanned bluetooth devices, and reporting all the unique identifier codes to be reported to the cloud server includes:
monitoring and receiving a device information data packet and a device address sent by each scanned Bluetooth device to serve as the connection feedback data;
analyzing the equipment information data packet of each Bluetooth equipment to obtain a corresponding equipment name, and if the equipment name accords with a preset name specification, combining the equipment name with the equipment address of the same Bluetooth equipment to obtain a corresponding unique identification code;
and reporting the unique identification codes obtained by all the combinations to the cloud server as the unique identification codes to be reported.
In one embodiment, after the sending the connection request to the target connection device based on the unique identification code in the connection instruction, the method further includes:
receiving a connection handle sent by the target connection device;
converting the value of the connection handle into a corresponding target index, creating a dynamic information list with the target index, and storing the unique identification codes of the connection handle and the target connection device into the dynamic information list with the target index; wherein, the values of the connection handles sent by different Bluetooth devices to be connected are different;
and receiving a write handle and a receive handle sent by the target connection equipment, and storing the write handle and the receive handle into a dynamic information list with the target index.
In one embodiment, the converting the value of the connection handle into the corresponding target index includes:
if the received value of the connection handle is increased from 0, taking the value of the connection handle as the target index;
if the received value of the connection handle is increased from 1, subtracting 1 from the value of the connection handle to be used as the target index;
if the received value of the connection handle is decremented from 255, the value of the connection handle is subtracted from 255 to be used as the target index.
In one embodiment, the method further comprises:
if the Bluetooth equipment is disconnected, searching a corresponding dynamic information list based on the connection handle of the disconnected Bluetooth equipment and deleting the corresponding dynamic information list.
In one embodiment, after the current connection number is equal to the to-be-connected number, the method further includes:
monitoring and receiving a control instruction sent by the cloud server; the control instruction comprises control content with preset data length, group control quantity of Bluetooth equipment to be controlled and unique identification codes of each appointed Bluetooth equipment to be controlled, wherein the group control quantity is smaller than or equal to the quantity to be connected;
searching a first target information list from all the created dynamic information lists based on the unique identification code of the target control equipment in the control instruction; the target control equipment is any one of all Bluetooth equipment to be controlled, and the unique identification code input by the first target information list is consistent with the unique identification code of the target control equipment;
reading a write handle in the first target information list, calling a sending interface based on the write handle, and sending control contents with the preset data length to the target control equipment through the sending interface to enable the current control quantity to be +1; wherein the initial value of the current control quantity is 0;
and if the current control quantity is smaller than the group control quantity, returning to execute the step of searching a first target information list and the subsequent steps in all the created dynamic information lists based on the unique identification code of the target control equipment in the control instruction until the current control quantity is equal to the group control quantity.
In one embodiment, after the current control number is equal to the group control number, the method further comprises:
monitoring and receiving control feedback data sent by each controlled Bluetooth device, analyzing a receiving handle in the control feedback data and feedback content with preset data length, and searching a second target information list in all the created dynamic information lists; wherein, the receiving handle input by the second target information list is consistent with the receiving handle in the control feedback data;
and reading the unique identification code in the second target information list, calling a receiving interface based on the receiving handle in the control feedback data, and packaging and reporting the feedback content with the preset data length and the unique identification code in the second target information list to a cloud server through the receiving interface.
A Bluetooth communication management system comprises a cloud server, a comprehensive gateway and a plurality of Bluetooth devices;
the plurality of Bluetooth devices are used for outputting broadcast signals, and the broadcast signals comprise unique identification codes of the Bluetooth devices;
the comprehensive gateway is used for monitoring the broadcast signals, extracting unique identification codes in the broadcast signals and sending the unique identification codes to the cloud server;
the cloud server is connected with the comprehensive gateway and is used for receiving the unique identification code sent by the comprehensive gateway and sending a connection instruction to the comprehensive gateway according to the unique identification code;
the comprehensive gateway is further used for monitoring and receiving the connection instructions sent by the cloud server, the connection instructions comprise the number of Bluetooth devices to be connected and unique identification codes of each designated Bluetooth device to be connected, and the comprehensive gateway is connected with the Bluetooth devices to be connected according to the connection instructions.
A bluetooth communication management device for an integrated gateway operating in a bluetooth master mode, the device comprising:
the unique identification code uploading module is used for scanning Bluetooth equipment currently broadcasting, determining unique identification codes to be reported based on connection feedback data sent by all scanned Bluetooth equipment, and reporting all the unique identification codes to be reported to the cloud server; wherein the bluetooth device operates in a bluetooth slave mode;
the connection instruction receiving module is used for monitoring and receiving the connection instruction sent by the cloud server; the connection instruction comprises the number of to-be-connected Bluetooth devices to be connected and unique identification codes of each designated Bluetooth device to be connected, wherein the number of to-be-connected Bluetooth devices to be connected is smaller than or equal to the number of reported unique identification codes;
the connection module is used for sending a connection request to the target connection equipment based on the unique identification code in the connection instruction, and enabling the current connection quantity to be +1 after Bluetooth connection is established with the target connection equipment; the target connection device is any one of all Bluetooth devices to be connected, and the initial value of the current connection quantity is 0; and if the current connection quantity is smaller than the to-be-connected quantity, returning to execute the step and the subsequent steps of sending the connection request to the target connection equipment based on the unique identification code in the connection instruction until the current connection quantity is equal to the to-be-connected quantity.
A computer-readable storage medium, in which a computer program is stored which, when executed by a processor, causes the processor to perform the steps of the above-described bluetooth communication management method.
The integrated gateway is characterized by comprising a memory and a processor, wherein the memory stores a computer program, and the computer program is executed by the processor to enable the processor to execute the steps of the Bluetooth communication management method.
The invention provides a Bluetooth communication management method, a device, a medium and equipment, wherein a comprehensive gateway can automatically discover which surrounding Bluetooth equipment is online and needs to be reported by scanning broadcast Bluetooth equipment, and equipment information does not need to be manually added. Then, the cloud server informs the comprehensive gateway of which devices need to be connected through the connection instruction, and the Bluetooth devices are sequentially connected with the target connection devices based on the unique identification codes in the connection instruction, so that the problems that repeated trial and error is very time-consuming and manual data addition is very complicated are avoided, the comprehensive gateway can dynamically connect and manage the Bluetooth devices according to broadcasting, rapid automatic connection can be realized, and the connection and management efficiency of the Bluetooth devices is improved.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Wherein:
fig. 1 is a flowchart of a bluetooth communication management method according to a first embodiment;
fig. 2 is a schematic flow chart of determining a unique identification code to be reported and reporting the unique identification code to a cloud server;
fig. 3 is a flowchart of a bluetooth communication management method according to a second embodiment;
fig. 4 is a schematic structural diagram of a bluetooth communication management device;
fig. 5 is a block diagram of the architecture of the integrated gateway.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The terms first, second and the like in the description and in the claims of the present application and in the above-described figures, are used for distinguishing between different objects and not for describing a particular sequential order. Furthermore, the terms "comprise" and "have," as well as any variations thereof, are intended to cover a non-exclusive inclusion. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those listed steps or elements but may include other steps or elements not listed or inherent to such process, method, article, or apparatus.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the present application. The appearances of such phrases 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 skill in the art will explicitly and implicitly appreciate that the embodiments described herein may be combined with other embodiments.
As shown in fig. 1, fig. 1 is a flow chart of a bluetooth communication management method in a first embodiment, where the embodiment is applied to one end of an integrated gateway for bluetooth communication with a plurality of bluetooth devices. The integrated gateway works in a Bluetooth master mode, namely, the integrated gateway is used as a party capable of actively initiating Bluetooth connection. The bluetooth device works in a bluetooth slave mode, namely, is a party waiting for bluetooth connection passively, and specifically, may be a device such as a mobile phone, an earphone, a smart watch and the like which has a bluetooth function and supports the bluetooth slave mode.
The bluetooth communication management method in this embodiment includes the steps of:
s101, scanning Bluetooth devices currently broadcasting, determining unique identification codes to be reported based on connection feedback data sent by all scanned Bluetooth devices, and reporting all the unique identification codes to be reported to a cloud server.
That is, when an integrated gateway performs a scanning operation, it searches all bluetooth devices that are broadcasting around in real time. These bluetooth devices periodically transmit broadcast signals that may contain information such as device name, device model number, device address, etc. The integrated gateway then determines from these broadcast signals whether it contains a unique identification code that needs to be reported. For example, the scanned bluetooth device includes 3 mobile phones, and only 2 mobile phones broadcast signals meeting the connection requirements, and only the unique identification codes corresponding to the 2 mobile phones meeting the connection requirements are reported. And finally, the comprehensive gateway sends all the unique identification codes to be reported to the cloud server. The cloud server may identify and manage a plurality of bluetooth devices through these identification codes, including but not limited to establishing connections with bluetooth devices, sending control instructions, and the like.
In a specific embodiment, as shown in fig. 2, the step of determining the unique identifier codes to be reported based on the connection feedback data sent by all the scanned bluetooth devices, and reporting all the unique identifier codes to be reported to the cloud server specifically includes:
and S101a, monitoring and receiving a device information data packet and a device address sent by each scanned Bluetooth device to serve as connection feedback data.
In this embodiment, the device information packet includes a broadcast packet and a possible scan response packet. The broadcast data and the scanning response packet each contain some basic information of the device, such as device name, service information, etc. The device address is in particular a medium access control address (Media Access Control address, mac) address for assisting the network device in addressing in the local area network.
S101b, analyzing the device information data packet of each Bluetooth device to obtain a corresponding device name, and if the device name accords with a preset name specification, combining the device name with the device address of the same Bluetooth device to obtain a corresponding unique identification code.
In this embodiment, the name specification may be in a format predefined by the user for screening connected bluetooth devices. Meanwhile, since there may be duplication of device addresses among a plurality of bluetooth devices, in this embodiment, the possibility of duplication is further avoided by combining the device names and the device addresses.
The integrated gateway analyzes the broadcast data and the device name in the scanning response packet, and determines and confirms whether the device name is prefixed by "HET-XXXX", which may be set in other forms; if the condition is met, the prefix HET-XXXX of the device name and the device mac address are spliced by a transverse line "-" to form a unique identification code ChildDeviceId (such as HET-5692-405EEA0913A 6), and the unique identification code ChildDeviceId is reported to a cloud server; repeating the above operation can obtain all required unique identification codes.
And S101c, reporting the unique identification codes obtained by all the combinations to a cloud server as the unique identification codes to be reported.
By the aid of the Bluetooth connection method and device, the cloud server can know how many Bluetooth devices currently meet the preconditions of Bluetooth connection, and different Bluetooth devices can be distinguished based on unique identification codes.
S102, monitoring and receiving a connection instruction sent by a cloud server.
The connection instruction comprises the number of to-be-connected Bluetooth devices to be connected and the unique identification code of each designated to-be-connected Bluetooth device, wherein the number of to-be-connected Bluetooth devices to be connected is smaller than or equal to the number of reported unique identification codes.
For example, assume that three bluetooth devices, a light bulb, a watch, and a sound box, are in the room, which all support slave modes, and the integrated gateway scans them and reports their device information to the cloud server. The connection instruction of the cloud server may include:
number of connections to be made: 2;
unique identification code of bulb: HET-XXXX-XXXXXXXXXXXXX 1
Unique identification code of the watch: HET-XXXX-XXXXXXXXXXXXX 2
This means that the cloud server requires the handset to connect to both the bluetooth device, the light bulb and the watch, without connecting to the sound box. The integrated gateway is thus able to dynamically connect all or part of the scanned compliant devices.
S103, sending a connection request to the target connection equipment based on the unique identification code in the connection instruction, and enabling the current connection quantity to be +1 after Bluetooth connection is established with the target connection equipment.
The target connection device is any one of all the bluetooth devices to be connected, that is, initiates the same request operation to all the bluetooth devices. The initial value of the current connection number is 0 in order to count the number of connected bluetooth devices.
Continuing with the example of S102, a connection request message may be sent to the bulb, including the device address and connection parameters of the handset. And waiting for the bulb to reply a connection response message, and if successful, establishing a low-power Bluetooth connection with the bulb.
S104, judging whether the current connection quantity is smaller than the quantity to be connected. If the current connection number is smaller than the to-be-connected number, returning to execute the step S103 and the subsequent steps. And if the current connection quantity is equal to the to-be-connected quantity, ending.
The following S103 example continues to describe, that is, since the number of to-be-connected is 2, the current number of connections is less than the number of to-be-connected, so that a connection request message is sent to the watch, the watch waits for a connection response message to be replied, if successful, the mobile phone establishes a bluetooth low energy connection with the watch, the current number of connections is 2, and the whole connection process is ended.
In the bluetooth communication management method according to the first embodiment, the integrated gateway can automatically discover which bluetooth devices around are online and need to be reported by scanning the broadcasted bluetooth devices, and does not need to manually add device information. Then, the cloud server informs the comprehensive gateway of which devices need to be connected through the connection instruction, and the Bluetooth devices are sequentially connected with the target connection devices based on the unique identification codes in the connection instruction, so that the problems that repeated trial and error is very time-consuming and manual data addition is very complicated are avoided, the comprehensive gateway can dynamically connect and manage the Bluetooth devices according to broadcasting, rapid automatic connection can be realized, and the connection and management efficiency of the Bluetooth devices is improved.
As shown in fig. 3, fig. 3 is a flow chart of a bluetooth communication management method in a second embodiment, which is applied to an integrated gateway, and the bluetooth communication management method in this embodiment includes the following steps:
s301, scanning Bluetooth devices currently broadcasting, determining unique identification codes to be reported based on connection feedback data sent by all scanned Bluetooth devices, and reporting all the unique identification codes to be reported to a cloud server.
S302, monitoring and receiving a connection instruction sent by a cloud server.
And S303, transmitting a connection request to the target connection device based on the unique identification code in the connection instruction.
In a specific implementation scenario, steps S301 to S303 are substantially identical to steps S101 to S103 in the bluetooth communication management method according to the first embodiment of the present invention, and will not be described herein.
S304, receiving the connection handle sent by the target connection device.
Wherein the connection handle is a number for uniquely identifying the connection in the bluetooth connection.
S305, converting the value of the connection handle into a corresponding target index, creating a dynamic information list with the target index, and storing the unique identification codes of the connection handle and the target connection device into the dynamic information list with the target index.
The values of the connection handles sent by different bluetooth devices to be connected are different, which is determined by manufacturers of bluetooth devices based on actual requirements. In this step, the integrated gateway converts the value of the connection handle into the corresponding target index and creates a dynamic information list in combination with the target index. The dynamic information list is used for storing all relevant information for establishing Bluetooth connection with the target device and also used for distinguishing information among various Bluetooth devices.
In one particular embodiment, converting the value of the connection handle to a corresponding target index includes:
if the received value of the connection handle is increased from 0, taking the value of the connection handle as a target index; if the received value of the connection handle is increased from 1, subtracting 1 from the value of the connection handle to be used as a target index; if the received connection handle value is decremented from 255, the connection handle value is subtracted from 255 to be used as the target index.
S306, receiving the writing handle and the receiving handle sent by the target connection device, and storing the writing handle and the receiving handle into a dynamic information list with a target index.
Wherein the write handle is for transmitting data to the bluetooth device; the receive handle is for receiving data from a bluetooth device, such as a notification handle NotifyHandle or an indication handle indirectionhandle. Their values are generated by the bluetooth device and their values of the value connection handle are different, all saved to the dynamic information list with the target index for subsequent data transmission and control.
In a specific embodiment, if it is monitored that the bluetooth device is disconnected, the corresponding dynamic information list may be searched and deleted based on the connection handle of the disconnected bluetooth device.
This step ensures that when the device is disconnected, the corresponding information is cleaned up in time, helping to maintain the accuracy and consistency of the dynamic information list. This is necessary for subsequent connection management and operation, preventing the presence of outdated or invalid information in the system due to the disconnection of the device.
S307, after the Bluetooth connection is established with the target connection device, the current connection quantity is enabled to be +1.
S308, judging whether the current connection quantity is smaller than the to-be-connected quantity. If the current connection number is smaller than the to-be-connected number, the process returns to S303 and the subsequent steps. If the current connection number is equal to the to-be-connected number, S309 is performed.
S309, monitoring and receiving a control instruction sent by the cloud server.
Specifically, the control instruction includes control content (for example, data codes corresponding to instructions such as turning on and off a bluetooth lamp) with a preset data length, the group control number of bluetooth devices to be controlled and unique identification codes of each specified bluetooth device to be controlled, where the group control number is less than or equal to the number to be connected, so that the integrated gateway can dynamically control all or part of scanned devices meeting the conditions.
Furthermore, after receiving the control instruction of the cloud server, the comprehensive gateway allocates the memory according to the maximum length principle of the preset instruction, so that the integrity and consistency of the instruction can be ensured, and the instruction is prevented from being truncated or disordered. In addition, control instructions can be placed at the bottom of a sending queue, wherein the sending queue is a data structure for storing instructions to be sent, and the data structure can ensure the first-in first-out sequence of the instructions and avoid the loss or repetition of the instructions.
S310, searching a first target information list in all the created dynamic information lists based on the unique identification code of the target control equipment in the control instruction.
The target control device is any one of all the bluetooth devices to be controlled, that is, performs the same operation on all the bluetooth devices to be controlled. Further, if a transmit queue is created, the unique identification code of the target control device is located at the top of the transmit queue and can be obtained directly from the top of the transmit queue.
The unique identification code recorded in the first target information list is consistent with the unique identification code of the target control equipment, so that correct transmission of data or control commands is ensured.
S311, reading a write handle in the first target information list, calling a sending interface based on the write handle, and sending control contents with preset data length to target control equipment through the sending interface to enable the current control quantity to be +1.
In this step, the integrated gateway obtains the write handle from the first target information list, and then invokes the transmitting interface according to the write handle, which is a function for transmitting data to the bluetooth device, and it can be used for subsequent data transmission and control, and finally, the transmitting interface transmits the control content with the preset data length to the target control device, so that the current control quantity is +1. The initial value of the current control number is 0 in order to count the number of bluetooth devices that have been controlled.
S312, judging whether the current control quantity is smaller than the group control quantity. If the current control number is smaller than the group control number, returning to execute the step S310 and the subsequent steps; if the current control number is equal to the group control number, S313 is performed.
S313, monitoring and receiving control feedback data sent by each controlled Bluetooth device, analyzing a receiving handle and feedback content with preset data length in the control feedback data, and searching a second target information list in all the created dynamic information lists.
And the receiving handle recorded in the second target information list is consistent with the receiving handle in the control feedback data.
The integrated gateway in this step is used for monitoring the data transmission of the bluetooth device, and when receiving the control feedback data of the bluetooth device, the integrated gateway needs to parse the feedback content of the receiving handle and the preset data length from the data packet, which is a text message containing data with specific meaning, such as a byte on-off state, or a character string. The comprehensive gateway searches a second target information list based on the receiving handle in all the created dynamic information lists, and the receiving handle recorded in the second target information list is consistent with the receiving handle in the control feedback data, so that the correct receiving and analyzing of the feedback data can be ensured.
S314, reading the unique identification code in the second target information list, calling a receiving interface based on a receiving handle in the control feedback data, and packaging and reporting the feedback content with the preset data length and the unique identification code in the second target information list to the cloud server through the receiving interface.
In this step, the integrated gateway calls the receiving interface according to the receiving handle in the control feedback data, which is a function for receiving data from the bluetooth device, and can be used for subsequent data transmission and control. And the comprehensive gateway packages and reports the feedback content with the preset data length and the unique identification code in the second target information list to the cloud server through the receiving interface. The integrated gateway can flexibly communicate and control with a plurality of Bluetooth devices, and report and manage data through the cloud server.
Furthermore, the comprehensive gateway can dynamically allocate memory according to the length of the received data, and store the feedback content with the preset data length and the unique identification code in the second target information list into the receiving queue; the comprehensive gateway judges whether data exists in the receiving queue, if so, the data in the receiving queue is packed and reported to the cloud server based on the receiving handle according to the first-in first-out principle of the queue, and therefore the loss or repetition of instructions can be avoided.
According to the Bluetooth communication management method of the second embodiment, the dynamic information list is created and managed, so that multiple devices can be further flexibly managed, single devices or multiple devices can be flexibly controlled, efficiency is improved, and better experience is brought to users.
In one embodiment, a bluetooth communication management system is provided, the system including a cloud server, a comprehensive gateway, and a plurality of bluetooth devices;
the plurality of Bluetooth devices are used for outputting broadcast signals, and the broadcast signals comprise unique identification codes of the Bluetooth devices;
the comprehensive gateway is used for monitoring the broadcast signals, extracting unique identification codes in the broadcast signals and sending the unique identification codes to the cloud server;
the cloud server is connected with the comprehensive gateway and is used for receiving the unique identification code sent by the comprehensive gateway and sending a connection instruction to the comprehensive gateway according to the unique identification code;
the comprehensive gateway is further used for monitoring and receiving the connection instructions sent by the cloud server, the connection instructions comprise the number of Bluetooth devices to be connected and unique identification codes of each designated Bluetooth device to be connected, and the comprehensive gateway is connected with the Bluetooth devices to be connected according to the connection instructions.
In one embodiment, as shown in fig. 4, a bluetooth communication management device is provided, which includes:
the unique identification code uploading module 401 is configured to scan bluetooth devices currently broadcasting, determine unique identification codes to be reported based on connection feedback data sent by all scanned bluetooth devices, and report all unique identification codes to be reported to a cloud server;
a connection instruction receiving module 402, configured to monitor and receive a connection instruction sent by a cloud server; the connection instruction comprises the number to be connected of the Bluetooth devices to be connected and the unique identification code of each appointed Bluetooth device to be connected, wherein the number to be connected is smaller than or equal to the number of reported unique identification codes;
a connection module 403, configured to send a connection request to a target connection device based on a unique identifier in the connection instruction, and after bluetooth connection is established with the target connection device, make the current connection number +1; the target connection device is any one of all Bluetooth devices to be connected, and the initial value of the current connection quantity is 0; and if the current connection quantity is smaller than the to-be-connected quantity, returning to execute the step of sending the connection request to the target connection equipment based on the unique identification code in the connection instruction and the subsequent step until the current connection quantity is equal to the to-be-connected quantity.
Fig. 5 illustrates an internal block diagram of an integrated gateway in one embodiment. As shown in fig. 5, the integrated gateway includes a processor, memory, and network interface connected by a system bus. The memory includes a nonvolatile storage medium and an internal memory. The non-volatile storage medium of the integrated gateway stores an operating system and may also store a computer program that, when executed by a processor, causes the processor to implement a bluetooth communication management method. The internal memory may also store a computer program that, when executed by the processor, causes the processor to perform the bluetooth communication management method. It will be appreciated by those skilled in the art that the architecture shown in fig. 5 is merely a block diagram of some of the architecture associated with the present application and is not limiting of the integrated gateway to which the present application is applied, and that a particular integrated gateway may include more or fewer components than shown, or may combine some of the components, or have a different arrangement of components.
A computer readable storage medium storing a computer program which when executed by a processor performs the steps of: scanning Bluetooth equipment currently broadcasting, determining unique identification codes to be reported based on connection feedback data sent by all scanned Bluetooth equipment, and reporting all the unique identification codes to be reported to a cloud server; monitoring and receiving a connection instruction sent by a cloud server; the connection instruction comprises the number to be connected of the Bluetooth devices to be connected and the unique identification code of each appointed Bluetooth device to be connected, wherein the number to be connected is smaller than or equal to the number of reported unique identification codes; transmitting a connection request to the target connection equipment based on the unique identification code in the connection instruction, and enabling the current connection quantity to be +1 after Bluetooth connection is established with the target connection equipment; the target connection device is any one of all Bluetooth devices to be connected, and the initial value of the current connection quantity is 0; and if the current connection quantity is smaller than the to-be-connected quantity, returning to execute the step of sending the connection request to the target connection equipment based on the unique identification code in the connection instruction and the subsequent step until the current connection quantity is equal to the to-be-connected quantity.
An integrated gateway comprising a memory, a processor and a computer program stored in the memory and executable on the processor, the processor implementing the following steps when executing the computer program: scanning Bluetooth equipment currently broadcasting, determining unique identification codes to be reported based on connection feedback data sent by all scanned Bluetooth equipment, and reporting all the unique identification codes to be reported to a cloud server; monitoring and receiving a connection instruction sent by a cloud server; the connection instruction comprises the number to be connected of the Bluetooth devices to be connected and the unique identification code of each appointed Bluetooth device to be connected, wherein the number to be connected is smaller than or equal to the number of reported unique identification codes; transmitting a connection request to the target connection equipment based on the unique identification code in the connection instruction, and enabling the current connection quantity to be +1 after Bluetooth connection is established with the target connection equipment; the target connection device is any one of all Bluetooth devices to be connected, and the initial value of the current connection quantity is 0; and if the current connection quantity is smaller than the to-be-connected quantity, returning to execute the step of sending the connection request to the target connection equipment based on the unique identification code in the connection instruction and the subsequent step until the current connection quantity is equal to the to-be-connected quantity.
It should be noted that the above-mentioned bluetooth communication management method, apparatus, device and computer readable storage medium belong to a general inventive concept, and the embodiments of the bluetooth communication management method, apparatus, device and computer readable storage medium are applicable to each other.
Those skilled in the art will appreciate that implementing all or part of the above-described methods in accordance with the embodiments may be accomplished by way of a computer program stored in a non-transitory computer-readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the various embodiments provided herein may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), memory bus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The foregoing examples represent only a few embodiments of the present application, which are described in more detail and are not thereby to be construed as limiting the scope of the present application. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application is to be determined by the claims appended hereto.

Claims (10)

1. A bluetooth communication management method, applied to an integrated gateway operating in a bluetooth master mode, the method comprising:
scanning Bluetooth equipment currently broadcasting, determining unique identification codes to be reported based on connection feedback data sent by all scanned Bluetooth equipment, and reporting all the unique identification codes to be reported to a cloud server; wherein the bluetooth device operates in a bluetooth slave mode;
monitoring and receiving a connection instruction sent by the cloud server; the connection instruction comprises the number of to-be-connected Bluetooth devices to be connected and unique identification codes of each designated Bluetooth device to be connected, wherein the number of to-be-connected Bluetooth devices to be connected is smaller than or equal to the number of reported unique identification codes;
transmitting a connection request to target connection equipment based on the unique identification code in the connection instruction, and enabling the current connection quantity to be +1 after Bluetooth connection is established with the target connection equipment; the target connection device is any one of all Bluetooth devices to be connected, and the initial value of the current connection quantity is 0;
and if the current connection quantity is smaller than the to-be-connected quantity, returning to execute the step and the subsequent steps of sending the connection request to the target connection equipment based on the unique identification code in the connection instruction until the current connection quantity is equal to the to-be-connected quantity.
2. The method according to claim 1, wherein determining the unique identification codes to be reported based on connection feedback data sent by all scanned bluetooth devices, and reporting all the unique identification codes to be reported to the cloud server includes:
monitoring and receiving a device information data packet and a device address sent by each scanned Bluetooth device to serve as the connection feedback data;
analyzing the equipment information data packet of each Bluetooth equipment to obtain a corresponding equipment name, and if the equipment name accords with a preset name specification, combining the equipment name with the equipment address of the same Bluetooth equipment to obtain a corresponding unique identification code;
and reporting the unique identification codes obtained by all the combinations to the cloud server as the unique identification codes to be reported.
3. The method of claim 1, wherein after the sending the connection request to the target connection device based on the unique identification code in the connection instruction, further comprising:
receiving a connection handle sent by the target connection device;
converting the value of the connection handle into a corresponding target index, creating a dynamic information list with the target index, and storing the unique identification codes of the connection handle and the target connection device into the dynamic information list with the target index; wherein, the values of the connection handles sent by different Bluetooth devices to be connected are different;
and receiving a write handle and a receive handle sent by the target connection equipment, and storing the write handle and the receive handle into a dynamic information list with the target index.
4. The method of claim 3, wherein the converting the value of the connection handle into the corresponding target index of indices comprises:
if the received value of the connection handle is increased from 0, taking the value of the connection handle as the target index;
if the received value of the connection handle is increased from 1, subtracting 1 from the value of the connection handle to be used as the target index;
if the received value of the connection handle is decremented from 255, the value of the connection handle is subtracted from 255 to be used as the target index.
5. A method according to claim 3, characterized in that the method further comprises:
if the Bluetooth equipment is disconnected, searching a corresponding dynamic information list based on the connection handle of the disconnected Bluetooth equipment and deleting the corresponding dynamic information list.
6. A method according to claim 3, further comprising, after the current number of connections is equal to the number of connections to be connected:
monitoring and receiving a control instruction sent by the cloud server; the control instruction comprises control content with preset data length, group control quantity of Bluetooth equipment to be controlled and unique identification codes of each appointed Bluetooth equipment to be controlled, wherein the group control quantity is smaller than or equal to the quantity to be connected;
searching a first target information list from all the created dynamic information lists based on the unique identification code of the target control equipment in the control instruction; the target control equipment is any one of all Bluetooth equipment to be controlled, and the unique identification code input by the first target information list is consistent with the unique identification code of the target control equipment;
reading a write handle in the first target information list, calling a sending interface based on the write handle, and sending control contents with the preset data length to the target control equipment through the sending interface to enable the current control quantity to be +1; wherein the initial value of the current control quantity is 0;
and if the current control quantity is smaller than the group control quantity, returning to execute the step of searching a first target information list and the subsequent steps in all the created dynamic information lists based on the unique identification code of the target control equipment in the control instruction until the current control quantity is equal to the group control quantity.
7. The method of claim 6, further comprising, after the current control quantity is equal to the group control quantity:
monitoring and receiving control feedback data sent by each controlled Bluetooth device, analyzing a receiving handle in the control feedback data and feedback content with preset data length, and searching a second target information list in all the created dynamic information lists; wherein, the receiving handle input by the second target information list is consistent with the receiving handle in the control feedback data;
and reading the unique identification code in the second target information list, calling a receiving interface based on the receiving handle in the control feedback data, and packaging and reporting the feedback content with the preset data length and the unique identification code in the second target information list to a cloud server through the receiving interface.
8. A Bluetooth communication management system is characterized by comprising a cloud server, a comprehensive gateway and a plurality of Bluetooth devices;
the plurality of Bluetooth devices are used for outputting broadcast signals, and the broadcast signals comprise unique identification codes of the Bluetooth devices;
the comprehensive gateway is used for monitoring the broadcast signals, extracting unique identification codes in the broadcast signals and sending the unique identification codes to the cloud server;
the cloud server is connected with the comprehensive gateway and is used for receiving the unique identification code sent by the comprehensive gateway and sending a connection instruction to the comprehensive gateway according to the unique identification code;
the comprehensive gateway is further used for monitoring and receiving the connection instructions sent by the cloud server, the connection instructions comprise the number of Bluetooth devices to be connected and unique identification codes of each designated Bluetooth device to be connected, and the comprehensive gateway is connected with the Bluetooth devices to be connected according to the connection instructions.
9. A computer readable storage medium, characterized in that a computer program is stored, which, when being executed by a processor, causes the processor to perform the steps of the method according to any of claims 1 to 7.
10. An integrated gateway comprising a memory and a processor, the memory storing a computer program that, when executed by the processor, causes the processor to perform the steps of the method of any of claims 1 to 7.
CN202311831124.XA 2023-12-26 2023-12-26 Bluetooth communication management method, system, storage medium and integrated gateway Pending CN117793681A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311831124.XA CN117793681A (en) 2023-12-26 2023-12-26 Bluetooth communication management method, system, storage medium and integrated gateway

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311831124.XA CN117793681A (en) 2023-12-26 2023-12-26 Bluetooth communication management method, system, storage medium and integrated gateway

Publications (1)

Publication Number Publication Date
CN117793681A true CN117793681A (en) 2024-03-29

Family

ID=90392346

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311831124.XA Pending CN117793681A (en) 2023-12-26 2023-12-26 Bluetooth communication management method, system, storage medium and integrated gateway

Country Status (1)

Country Link
CN (1) CN117793681A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118075920A (en) * 2024-04-18 2024-05-24 合肥综合性国家科学中心人工智能研究院(安徽省人工智能实验室) Bluetooth equipment networking method, system, bluetooth gateway and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118075920A (en) * 2024-04-18 2024-05-24 合肥综合性国家科学中心人工智能研究院(安徽省人工智能实验室) Bluetooth equipment networking method, system, bluetooth gateway and storage medium

Similar Documents

Publication Publication Date Title
CN113596191A (en) Data processing method, network element equipment and readable storage medium
US10887745B2 (en) Method and device for sharing file between different terminals
US10560929B2 (en) Resource request method and system, device, and network side node
CN107105050B (en) Storage and downloading method and system for service objects
CN103973421A (en) File transmitting method and device
JP2010509813A (en) Notification message processing method and apparatus
CN117793681A (en) Bluetooth communication management method, system, storage medium and integrated gateway
CN110049531A (en) network resource sharing method and related device
CN113516980A (en) Scene linkage method, and scene linkage system construction method and device
CN103401738A (en) Terminal connecting method and terminal connecting device
CN101252755B (en) Mobile communication terminal and monitoring method thereof
CN111478816A (en) Method, system, device and medium for configuring Zigbee and ZigBee sub-equipment
CN117544938B (en) Pairing method, device, equipment and storage medium of wireless microphone
EP3015990B1 (en) Information processing device, and destination information updating method and program
CN105611608A (en) Wireless local area network communication method, terminal and system
CN100361471C (en) System and method for dynamically allocating addresses and related equipment
KR101677524B1 (en) Method, base station, and network system for automatic x2 configuration deletion
CN109803333B (en) Coupling redirection method and device
CN105812412A (en) Transmission processing and remote processing method and device
CN103457984A (en) Method and system for automatic synchronous upgrade control
CN113595894A (en) Communication method, device, equipment and medium between service nodes and client nodes
CN104980880A (en) Communication apparatus and communication method
CN117376300B (en) Message all-channel sending method and device, electronic equipment and storage medium
CN113992732B (en) Terminal management control method, device, server and storage medium
CN108377519B (en) Method and device for processing session connection

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