Bluetooth communication method, apparatus and device
By determining and storing the Bluetooth information of the other device after a Bluetooth connection is established, the problem of low information exchange efficiency in Bluetooth communication is solved, achieving more efficient communication.
Patent Information
- Application Number
- CN202111661163.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-30
- Publication Date
- 2026-02-06
- Estimated Expiration
- 2041-12-30
AI Technical Summary
In Bluetooth communication, the exchange of Bluetooth information between devices is inefficient, resulting in low communication efficiency.
After the devices establish a Bluetooth connection, it checks whether the other party's Bluetooth information is stored. If it is, it directly retrieves and uses it; otherwise, it retrieves and stores the information from the other party's device to avoid repeated interactions.
It improves Bluetooth communication efficiency, reduces the number of information exchanges between devices, and increases communication speed.
Smart Images

Figure CN114374958B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of wireless communication technology, and in particular to a Bluetooth communication method, apparatus, and device. Background Technology
[0002] Devices can exchange information wirelessly via Bluetooth (BT) technology. For example, devices can be laptops, mobile phones, tablets, wireless headphones, etc.
[0003] In related technologies, before two devices can transmit Bluetooth data, they need to establish a Bluetooth connection and exchange their respective Bluetooth information. This Bluetooth information can include various details, such as the Bluetooth version and communication rate. During this exchange, one device typically needs to request multiple pieces of information from the other device, such as the Bluetooth version and rate. In other words, the two devices require multiple interactions to exchange Bluetooth information, resulting in low efficiency and consequently low Bluetooth communication efficiency. Summary of the Invention
[0004] This application provides a Bluetooth communication method, apparatus, and device, which improves Bluetooth communication efficiency.
[0005] In a first aspect, embodiments of this application provide a Bluetooth communication method, including:
[0006] After the first device establishes a Bluetooth connection with the second device, the first device determines whether it has stored the Bluetooth information of the second device.
[0007] If so, the Bluetooth information of the second device is obtained in the first device, and Bluetooth communication is performed with the second device based on the Bluetooth information of the second device;
[0008] If not, then obtain the Bluetooth information of the second device from the second device, and communicate with the second device via Bluetooth based on the Bluetooth information of the second device.
[0009] In one possible implementation, after the first device establishes a Bluetooth connection with the second device, the first device determines whether it stores Bluetooth information of the second device, including:
[0010] After the first device and the second device establish a Bluetooth connection, the first device obtains the device type and configuration information of the second device;
[0011] When the device type of the second device is a preset type and the configuration information indicates that the second device supports a Bluetooth information storage function, the first device acquires a device identifier of the second device, and determines whether the Bluetooth information of the second device is stored according to the device identifier of the second device.
[0012] In a possible implementation, the determining whether the Bluetooth information of the second device is stored according to the device identifier of the second device includes:
[0013] acquiring a storage address;
[0014] determining whether the Bluetooth information corresponding to the device identifier of the second device is stored in a storage region where the storage address is located;
[0015] if yes, it is determined that the Bluetooth information of the second device is stored in the first device;
[0016] if no, it is determined that the Bluetooth information of the second device is not stored in the first device.
[0017] In a possible implementation, the determining whether the Bluetooth information of the second device is stored according to the device identifier of the second device includes:
[0018] acquiring a device identifier set, the device identifier set including device identifiers of a plurality of devices, and the Bluetooth information of the plurality of devices being stored in the first device;
[0019] determining whether the device identifier set includes the device identifier of the second device;
[0020] if yes, it is determined that the Bluetooth information of the second device is stored in the first device;
[0021] if no, it is determined that the Bluetooth information of the second device is not stored in the first device.
[0022] In a possible implementation, after the Bluetooth information of the second device is acquired from the second device, the method further includes:
[0023] the first device acquires a device type and configuration information of the second device;
[0024] when the device type of the second device is a preset type and the configuration information indicates that the second device supports a Bluetooth information storage function, storing the Bluetooth information of the second device.
[0025] In a possible implementation, the storing the Bluetooth information of the second device includes:
[0026] acquiring a storage address;
[0027] storing the Bluetooth information of the second device in the storage area corresponding to the storage address.
[0028] In a possible implementation, the storing of the Bluetooth information of the second device in the storage area corresponding to the storage address comprises:
[0029] acquiring a remaining storage space of the storage area;
[0030] if the size of the remaining storage space is greater than or equal to a preset threshold, storing the Bluetooth information of the second device in the storage area;
[0031] if the size of the remaining storage space is less than the preset threshold, deleting first Bluetooth information in the storage area and storing the Bluetooth information of the second device in the storage area.
[0032] In a possible implementation, the deleting of the first Bluetooth information in the storage area comprises:
[0033] acquiring a latest use time of each Bluetooth information in the storage area;
[0034] determining the Bluetooth information with the latest use time as the first Bluetooth information;
[0035] deleting the first Bluetooth information in the storage area.
[0036] In a possible implementation, the method further comprises:
[0037] adding a device identifier of the second device to a device identifier set.
[0038] In a possible implementation, the first device stores the Bluetooth information of the second device; and the method further comprises:
[0039] the first device receiving update information sent by the second device;
[0040] the first device updating the stored Bluetooth information of the second device according to the update information.
[0041] In a possible implementation, the updating of the stored Bluetooth information of the second device according to the update information by the first device comprises:
[0042] if the update information comprises latest Bluetooth information, the first device updates the stored Bluetooth information of the second device according to the latest Bluetooth information;
[0043] If the update information does not include the latest Bluetooth information, the first device acquires the latest Bluetooth information from the second device, and the first device updates the stored Bluetooth information of the second device according to the latest Bluetooth information.
[0044] In a possible implementation, the first device updating the stored Bluetooth information of the second device according to the latest Bluetooth information comprises:
[0045] If the latest Bluetooth information is part of the Bluetooth information of the second device, the first device determines replacement information corresponding to the part of the Bluetooth information in the storage area, and replaces the replacement information with the latest Bluetooth information.
[0046] If the latest Bluetooth information is all of the Bluetooth information of the second device, the first device replaces the Bluetooth information of the second device in the storage area with the latest Bluetooth information.
[0047] In a second aspect, an embodiment of the present application provides a Bluetooth communication device, comprising a judging module, a first acquiring module and a second acquiring module, wherein,
[0048] The judging module is configured to judge whether the first device stores Bluetooth information of a second device after the first device and the second device establish a Bluetooth connection.
[0049] The first acquiring module is configured to acquire the Bluetooth information of the second device in the first device and perform Bluetooth communication with the second device according to the Bluetooth information of the second device when the judging module judges that the first device stores the Bluetooth information of the second device.
[0050] The second acquiring module is configured to acquire the Bluetooth information of the second device from the second device and perform Bluetooth communication with the second device according to the Bluetooth information of the second device when the judging module judges that the first device does not store the Bluetooth information of the second device.
[0051] In a possible implementation, the judging module 11 is specifically configured to:
[0052] After the first device and the second device establish a Bluetooth connection, the first device acquires device type and configuration information of the second device.
[0053] When the device type of the second device is a preset type and the configuration information indicates that the second device supports a Bluetooth information storage function, the first device acquires a device identifier of the second device, and judges whether the first device stores the Bluetooth information of the second device according to the device identifier of the second device.
[0054] In a possible implementation, the judging module is specifically configured to:
[0055] obtain a storage address;
[0056] determine whether the storage area where the storage address is located stores the Bluetooth information corresponding to the device identifier of the second device;
[0057] if yes, it is determined that the Bluetooth information of the second device is stored in the first device;
[0058] if no, it is determined that the Bluetooth information of the second device is not stored in the first device.
[0059] In a possible implementation, the judging module is specifically configured to:
[0060] obtain a device identifier set, the device identifier set including device identifiers of a plurality of devices, and the Bluetooth information of the plurality of devices being stored in the first device;
[0061] determine whether the device identifier set includes the device identifier of the second device;
[0062] if yes, it is determined that the Bluetooth information of the second device is stored in the first device;
[0063] if no, it is determined that the Bluetooth information of the second device is not stored in the first device.
[0064] In a possible implementation, the Bluetooth communication apparatus further includes a third obtaining module and a storage module, wherein,
[0065] the third obtaining module is configured to, after the first obtaining module obtains the Bluetooth information of the second device from the second device, obtain the device type and configuration information of the second device;
[0066] the storage module is configured to, when the device type of the second device is a preset type and the configuration information indicates that the second device supports a Bluetooth information storage function, store the Bluetooth information of the second device.
[0067] In a possible implementation, the storage module is specifically configured to:
[0068] obtain a storage address;
[0069] store the Bluetooth information of the second device in the storage area corresponding to the storage address.
[0070] In a possible implementation, the storage module is specifically configured to:
[0071] acquire a remaining storage space of the storage area;
[0072] if a size of the remaining storage space is greater than or equal to a preset threshold, store the Bluetooth information of the second device in the storage area;
[0073] if the size of the remaining storage space is less than the preset threshold, delete the first Bluetooth information in the storage area, and store the Bluetooth information of the second device in the storage area.
[0074] In a possible implementation, the storage module is specifically configured to:
[0075] acquire a latest use time of each Bluetooth information in the storage area;
[0076] determine the Bluetooth information with the latest use time as the first Bluetooth information;
[0077] delete the first Bluetooth information in the storage area.
[0078] In a possible implementation, the storage module is further configured to:
[0079] add a device identifier of the second device in a device identifier set.
[0080] In a possible implementation, the first device stores the Bluetooth information of the second device; the Bluetooth communication apparatus further includes a receiving module and an updating module, wherein,
[0081] the receiving module is configured to receive the updating information sent by the second device;
[0082] the updating module is configured to update the stored Bluetooth information of the second device according to the updating information.
[0083] In a possible implementation, the updating module is specifically configured to:
[0084] if the updating information includes the latest Bluetooth information, the first device updates the stored Bluetooth information of the second device according to the latest Bluetooth information;
[0085] if the updating information does not include the latest Bluetooth information, the first device acquires the latest Bluetooth information from the second device, and the first device updates the stored Bluetooth information of the second device according to the latest Bluetooth information.
[0086] In a possible implementation, the first device updates the stored Bluetooth information of the second device according to the latest Bluetooth information, and the updating module is specifically configured to:
[0087] If the latest Bluetooth information is part of the Bluetooth information of the second device, the first device determines replacement information corresponding to the part of the Bluetooth information in the storage area, and replaces the replacement information as the latest Bluetooth information.
[0088] If the latest Bluetooth information is all of the Bluetooth information of the second device, the first device replaces the Bluetooth information of the second device in the storage area as the latest Bluetooth information.
[0089] In a third aspect, an embodiment of the present application provides a Bluetooth communication device, comprising a processor and a memory.
[0090] The memory stores computer execution instructions.
[0091] The processor executes the computer execution instructions stored in the memory, so that the processor executes the Bluetooth communication method according to any one of the first aspect.
[0092] In a fourth aspect, an embodiment of the present application provides a computer readable storage medium, which stores computer execution instructions, and when a processor executes the computer execution instructions, the Bluetooth communication method according to any one of the first aspect is implemented.
[0093] In a fifth aspect, an embodiment of the present application provides a computer program product, which comprises a computer program, and when a processor executes the computer program, the Bluetooth communication method according to any one of the first aspect is implemented.
[0094] The Bluetooth communication method, device and equipment provided by the embodiments of the present application, after the first device and the second device establish Bluetooth connection, the first device judges whether the Bluetooth information of the second device is stored; if yes, the Bluetooth information of the second device is acquired in the first device, and Bluetooth communication is performed with the second device according to the Bluetooth information of the second device; if not, the Bluetooth information of the second device is acquired from the second device, and Bluetooth communication is performed with the second device according to the Bluetooth information of the second device. In the above process, the first device can store the Bluetooth information of the second device locally, and when the first device and the second device need to perform Bluetooth communication, the Bluetooth information of the second device is directly called locally, so that the Bluetooth information interaction between the two devices is avoided, and the Bluetooth communication efficiency is improved. BRIEF DESCRIPTION OF DRAWINGS
[0095] Figure 1 An application scenario diagram is provided for the embodiments of the present application.
[0096] Figure 2 A flowchart of a Bluetooth communication method is provided for the embodiments of the present application.
[0097] Figure 3A flowchart illustrating another Bluetooth communication method provided in an embodiment of this application;
[0098] Figure 4 This is a schematic diagram of the structure of a Bluetooth communication device provided in an embodiment of this application;
[0099] Figure 5 This is a schematic diagram of another Bluetooth communication device provided in an embodiment of this application;
[0100] Figure 6 A schematic diagram of the hardware structure of the Bluetooth communication device provided in this application. Detailed Implementation
[0101] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0102] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0103] Figure 1 This is a schematic diagram illustrating an application scenario provided in an embodiment of this application. Please refer to [link / reference]. Figure 1 This includes a first device 101 and a second device 102. Both the first device 101 and the second device 102 have Bluetooth functionality. For example, the first device 101 can be a mobile phone, and the second device 102 can be a wireless headset.
[0104] Bluetooth communication can be performed between the first device 101 and the second device 102. Before the Bluetooth communication is performed, the first device 101 and the second device 102 need to establish a Bluetooth connection, exchange Bluetooth information, and establish a Bluetooth data channel. For example, when the first device 101 is a mobile phone and the second device 102 is a wireless earphone, if the first device 101 and the second device 102 need to perform Bluetooth communication, a Bluetooth connection needs to be established between the first device 101 and the second device 102, Bluetooth information needs to be exchanged, and a Bluetooth data channel needs to be established, and Bluetooth data transmission is performed through the Bluetooth data channel. For example, the Bluetooth information can include a Bluetooth version, a communication rate, and the like.
[0105] In the related art, in the process of establishing a Bluetooth connection by the first device and the second device, Bluetooth information is exchanged one by one to complete the Bluetooth information exchange. For example, when the Bluetooth information includes N pieces of information, the first device and the second device need to exchange information 1, exchange information 2, …, and exchange information N to realize the Bluetooth information exchange. Through the Bluetooth information exchange, the first device can obtain the Bluetooth information (information 1, information 2, …, and information N) of the second device. The Bluetooth information usually includes multiple pieces of information, so that the first device and the second device need to exchange information a plurality of times, which leads to a low efficiency of establishing Bluetooth communication between devices.
[0106] In the embodiment of the present application, after the first device obtains the Bluetooth information of the second device, the Bluetooth information of the second device is stored locally. When the first device and the second device need to establish a Bluetooth connection again, the first device can directly retrieve the Bluetooth information of the second device locally, without the need to exchange Bluetooth information again, thereby improving the Bluetooth communication efficiency.
[0107] In the following, the technical solutions shown in the present application are described through specific embodiments. It should be noted that the following embodiments can exist independently or can be combined with each other. For the same or similar content, the description is not repeated in different embodiments.
[0108] Figure 2 A flowchart of a Bluetooth communication method provided in the embodiment of the present application is shown. Please refer to Figure 2 The method can include the following steps.
[0109] S201, the first device and the second device establish a Bluetooth connection.
[0110] The execution subject of the embodiment of the present application can be the first device, or a Bluetooth communication device provided in the first device. The Bluetooth communication device can be implemented by software, or by a combination of software and hardware.
[0111] The first device and the second device can establish a Bluetooth connection according to the Bluetooth protocol. For example, the first device and the second device can first be paired, and then establish a Bluetooth connection after the pairing is successful.
[0112] S202, the first device determines whether the Bluetooth information of the second device is stored.
[0113] When the first device and the second device first communicate via Bluetooth, the first device can store the Bluetooth information of the second device obtained in the Bluetooth information interaction process locally. In this way, when the first device and the second device communicate via Bluetooth again, the Bluetooth information of the second device can be obtained locally in the first device.
[0114] The first device can determine whether the Bluetooth information of the second device is stored by the following method: after the first device and the second device establish a Bluetooth connection, the first device obtains the device type and configuration information of the second device; when the device type of the second device is a preset type and the configuration information indicates that the second device supports the Bluetooth information storage function, the first device obtains the device identifier of the second device, and determines whether the Bluetooth information of the second device is stored according to the device identifier of the second device.
[0115] The device of the preset type refers to the device that needs to improve the Bluetooth communication speed, and vice versa, the device that does not need to improve the Bluetooth communication speed is a non-preset type device.
[0116] The preset type can include earphones, mobile phones, and the like.
[0117] For example, when the second device is a Bluetooth sound, the user will adjust the position and volume of the second device when using the second device. During this adjustment process, the first device and the second device can complete the tasks of establishing a Bluetooth connection, interacting Bluetooth information, and the like, and the two devices are in a state of being able to perform Bluetooth data transmission, that is, the Bluetooth communication speed of the second device can meet the user's demand, and the second device does not need to improve the Bluetooth communication speed, that is, the second device does not belong to the preset type device.
[0118] For example, when the second device is a wireless earphone, since the process from picking up the second device to wearing the second device is very short, the first device and the second device cannot complete the tasks of establishing a Bluetooth connection, interacting Bluetooth information, and the like during this process. The user expects to improve the Bluetooth communication speed of the second device to obtain a better experience, so the second device belongs to the device that needs to improve the Bluetooth communication speed, that is, the second device belongs to the preset type device.
[0119] The configuration information is used to indicate whether the second device has the function of improving Bluetooth communication speed. In all embodiments of this application, the first devices have the function of improving Bluetooth communication speed. During Bluetooth information exchange, the first devices need to obtain each other's Bluetooth information. At this time, the device with the function of improving Bluetooth communication speed can store the other party's Bluetooth information locally; that is, the device with the function of improving Bluetooth communication speed supports Bluetooth information storage functionality.
[0120] Device identifier refers to the device name that identifies the device. For example, the device identifier of the second device can be Earphone No. 1, Earphone No. 2, etc.
[0121] After the first device and the second device establish a Bluetooth connection, the first device can obtain the device type and configuration information of the second device to confirm whether the second device belongs to a preset type and whether it supports Bluetooth information storage. If the second device belongs to the preset type and supports Bluetooth information storage, the first device determines whether its Bluetooth information is stored locally based on the second device's device identifier. That is, the first device can only store the second device's Bluetooth information if the second device belongs to the preset type and supports Bluetooth information storage. Only in this case does the first device determine whether its Bluetooth information is stored locally. This avoids searching for the second device's Bluetooth information locally when it is impossible for the second device to have it, thus improving Bluetooth communication efficiency.
[0122] For example, if the first device is a mobile phone and the second device is a wireless headset, and the second device supports Bluetooth information storage, and its device identifier is "Earphone No. 1", after the first and second devices establish a Bluetooth connection, the first device can obtain the device type and configuration information of the second device. If the second device is a preset type device and supports Bluetooth information storage, the first device will determine whether it has stored Bluetooth information for "Earphone No. 1" locally.
[0123] If the first device determines that it has stored the Bluetooth information of the second device, then execute S203.
[0124] If the first device determines that it has not stored the Bluetooth information of the second device, then execute S204.
[0125] S203. Obtain Bluetooth information of the second device from the first device.
[0126] If the Bluetooth information of the second device is stored locally, the first device can directly retrieve the Bluetooth information of the second device from the local storage.
[0127] For example, the second device is a preset type device supporting a Bluetooth information storage function. If the first device and the second device have performed Bluetooth communication, when the first device and the second device need to perform Bluetooth communication again, the first device can call the Bluetooth information of the second device from the local device.
[0128] S204, obtaining the Bluetooth information of the second device from the second device.
[0129] If the Bluetooth information of the second device is not stored in the local device, the first device and the second device obtain the Bluetooth information of the second device from the second device through Bluetooth information interaction.
[0130] If the first device and the second device perform Bluetooth communication for the first time, and the Bluetooth information of the second device is not stored in the local device, the first device and the second device obtain the Bluetooth information of the second device from the second device through Bluetooth information interaction.
[0131] If the second device is a preset type device, and the second device supports a Bluetooth information storage function, after obtaining the Bluetooth information of the second device from the second device, the Bluetooth information of the second device can be stored. After obtaining the Bluetooth information of the second device from the second device, the Bluetooth information of the second device can be stored in the following manner: the first device obtains the device type and configuration information of the second device; when the device type of the second device is a preset type and the configuration information indicates that the second device supports a Bluetooth information storage function, the Bluetooth information of the second device is stored.
[0132] S205, performing Bluetooth communication with the second device according to the Bluetooth information of the second device.
[0133] After the first device and the second device complete the establishment of Bluetooth connection, Bluetooth information interaction and other operations, Bluetooth communication can be performed, that is, Bluetooth data transmission can be performed.
[0134] The Bluetooth communication method provided by the embodiment of the present application can be used as follows: after the first device and the second device establish Bluetooth connection, the first device judges whether the Bluetooth information of the second device is stored; if yes, the Bluetooth information of the second device is obtained in the first device, and Bluetooth communication is performed with the second device according to the Bluetooth information of the second device; if no, the Bluetooth information of the second device is obtained from the second device, and Bluetooth communication is performed with the second device according to the Bluetooth information of the second device. In the above process, the first device can store the Bluetooth information of the second device in the local device, and when the first device and the second device need to perform Bluetooth communication, the Bluetooth information of the second device can be directly called from the local device, so that the Bluetooth information interaction between the two devices is reduced, and the Bluetooth communication efficiency is improved.
[0135] On the basis of any one of the above embodiments, the Bluetooth communication method provided by the present application will be described in detail as follows. Figure 3 The Bluetooth communication method provided by the present application will be described in detail as follows.
[0136] Figure 3 Another flowchart of a Bluetooth communication method is provided for the embodiments of the present application. Please refer to Figure 3 The method can include:
[0137] S301, the first device establishes a Bluetooth connection with the second device.
[0138] It should be noted that the execution process of S301 can refer to the execution process of S201, which will not be repeated here.
[0139] S302, the first device obtains the device type and configuration information of the second device.
[0140] The first device can obtain the device type of the second device in the following two ways:
[0141] Method 1: The first device can determine the device type of the second device through the device identifier of the second device.
[0142] After the first device and the second device establish a Bluetooth connection, the first device can obtain the device identifier of the second device, and determine the device type of the second device according to the device identifier of the second device.
[0143] For example, in the process of establishing a Bluetooth connection between the first device and the second device, the first device can obtain the device name (device identifier) of the second device. Assuming that the device identifier of the second device is a headset, the device type of the second device can be determined as a headset type. Assuming that the device identifier of the second device is a sound box, the device type of the second device can be determined as a sound box type.
[0144] Method 2: The first device receives the device type of the second device from the second device.
[0145] In the process of establishing a Bluetooth connection between the first device and the second device, or after the first device and the second device establish a Bluetooth connection, the second device can send the device type of the second device to the first device, so that the first device obtains the device type of the second device.
[0146] In the process of establishing a Bluetooth connection between the first device and the second device, or after the first device and the second device establish a Bluetooth connection, the second device can send the configuration information of the second device to the first device, so that the first device obtains the configuration information of the second device.
[0147] S303, obtain a device identifier set, the device identifier set includes device identifiers of a plurality of devices, and the first device stores Bluetooth information of the plurality of devices.
[0148] The first device can store Bluetooth information of a plurality of devices, and store device identifiers of the plurality of devices, the device identifiers can form a device identifier set, and the device identifiers correspond to the Bluetooth information one by one. For example, if the device identifier set includes a first earphone (device identifier), the first device stores Bluetooth information of the first earphone.
[0149] In S304, the first device determines whether the device identifier set includes a device identifier of the second device.
[0150] If yes, S305 is performed.
[0151] If no, S306 is performed.
[0152] When storing the Bluetooth information of the second device in the storage area, the first device can store the device identifier of the second device in the device identifier set, and the device identifiers correspond to the Bluetooth information one by one. Therefore, after obtaining the device identifier of the second device, the first device can determine whether the device identifier set includes the device identifier of the second device. If yes, it is determined that the first device stores the device identifier of the second device. If no, it is determined that the first device does not store the device identifier of the second device.
[0153] In S305, the first device obtains the Bluetooth information of the second device.
[0154] When the first device stores the Bluetooth information of the second device, the first device can obtain the Bluetooth information of the second device locally.
[0155] In S306, the first device obtains the Bluetooth information of the second device from the second device.
[0156] If the first device does not store the Bluetooth information of the second device locally, the first device can obtain the Bluetooth information of the second device by Bluetooth information interaction, that is, from the second device.
[0157] In S307, when the device type of the second device is a preset type and the configuration information indicates that the second device supports the Bluetooth information storage function, a storage address is obtained.
[0158] When the device type of the second device is a preset type and the second device supports the Bluetooth information storage function, a storage address of a storage area in the first device for storing Bluetooth information of other devices is obtained, so as to store the Bluetooth information of the second device locally.
[0159] In S308, a remaining storage space of the storage area is obtained.
[0160] The storage space of the device is limited, and the Bluetooth information that can be stored is also limited, that is, a limited number of Bluetooth information of other devices can be stored in the first device.
[0161] Before storing the Bluetooth information of the second device into the first device, it is determined whether there is enough space in the first device to store the Bluetooth information of the second device.
[0162] S309, determining whether the size of the remaining storage space is greater than or equal to a preset threshold.
[0163] If yes, S310 is performed.
[0164] If no, S311 is performed.
[0165] The preset threshold is usually set as the space occupied by the Bluetooth information of a device, wherein the device is a device with the largest space occupied by Bluetooth information among a plurality of devices.
[0166] For example, the space occupied by the Bluetooth information of all devices with Bluetooth function ranges from 20M to 30M, and 30M is set as the preset threshold.
[0167] S310, storing the Bluetooth information of the second device in the storage area.
[0168] S311, deleting the first Bluetooth information in the storage area and storing the Bluetooth information of the second device in the storage area.
[0169] The first Bluetooth information refers to the Bluetooth information with the earliest use time among all the Bluetooth information stored in the first device, i.e., the Bluetooth information that has not been used for the longest time.
[0170] The first Bluetooth information can be Bluetooth information with a low use frequency or even Bluetooth information that will not be used again. When the storage space in the first device is insufficient, the first Bluetooth information can be deleted to recycle the storage resource so as to store the Bluetooth information of other devices.
[0171] The first Bluetooth information can be deleted in the storage area in the following manner: obtaining the latest use time of each Bluetooth information in the storage area; determining the Bluetooth information with the latest use time as the first Bluetooth information; and deleting the first Bluetooth information in the storage area.
[0172] After ensuring sufficient storage space, the Bluetooth information of the second device obtained from the second device is stored in the storage area of the first device.
[0173] S312, adding the device identifier of the second device to the device identifier set.
[0174] The Bluetooth information and the device identifier correspond to each other. After storing the Bluetooth information of the second device obtained from the second device in the storage area of the first device, the device identifier of the second device is added to the device identifier set so as to directly obtain the Bluetooth information of the second device from the first device next time.
[0175] S313, the first device receives the update information sent by the second device.
[0176] Because of system upgrade or update, etc., the Bluetooth information of the second device will change. When the Bluetooth information changes, the second device will send update information to the first device to prompt the first device to update the Bluetooth information of the second device stored locally when the next Bluetooth communication is performed.
[0177] S314, the first device updates the stored Bluetooth information of the second device according to the update information.
[0178] The update information can include the latest Bluetooth information of the second device.
[0179] When part of the Bluetooth information of the second device changes, the latest Bluetooth information is the changed Bluetooth information in the Bluetooth information of the second device. When all of the Bluetooth information of the second device changes, the latest Bluetooth information is the changed Bluetooth information.
[0180] If the latest Bluetooth information is part of the Bluetooth information of the second device, the first device determines the replacement information corresponding to the part of the Bluetooth information in the storage area, and replaces the replacement information with the latest Bluetooth information.
[0181] If the latest Bluetooth information is all of the Bluetooth information of the second device, the first device replaces the Bluetooth information of the second device in the storage area with the latest Bluetooth information.
[0182] It should be noted that if the update information does not include the latest Bluetooth information, the first device obtains the latest Bluetooth information from the second device, and the first device updates the stored Bluetooth information of the second device according to the latest Bluetooth information.
[0183] The Bluetooth communication method provided by the embodiment of the application, after the first device establishes Bluetooth connection with the second device, the first device judges whether the Bluetooth information of the second device is stored locally. If yes, the Bluetooth information of the second device is obtained in the first device, and if no, the Bluetooth information of the second device is obtained from the second device. If the Bluetooth information of the second device is obtained from the second device, the Bluetooth information can be stored locally, and the device identifier of the second device can be added to the device identifier set. When the Bluetooth information of the second device changes, the Bluetooth information of the second device stored locally is updated according to the update information. When the local storage space is insufficient, the first Bluetooth information is deleted. In the above process, the first device can store the Bluetooth information of the second device locally, and can update the stored Bluetooth information. When the storage space is insufficient, the first Bluetooth information is deleted to recycle storage resources to obtain sufficient storage space to store the Bluetooth information of the second device, avoiding more Bluetooth information interaction between the two devices, and improving the Bluetooth communication efficiency.
[0184] Figure 4 A structural schematic diagram of a Bluetooth communication device is provided in the embodiments of the present application. Please refer to Figure 4 The Bluetooth communication device 10 comprises a judging module 11, a first obtaining module 12 and a second obtaining module 13, wherein,
[0185] The judging module 11 is configured to judge whether the Bluetooth information of the second device is stored in the first device after the first device and the second device establish Bluetooth connection.
[0186] The first obtaining module 12 is configured to obtain the Bluetooth information of the second device in the first device and perform Bluetooth communication with the second device according to the Bluetooth information of the second device when the judging module 11 judges that the Bluetooth information of the second device is stored in the first device.
[0187] The second obtaining module 13 is configured to obtain the Bluetooth information of the second device from the second device and perform Bluetooth communication with the second device according to the Bluetooth information of the second device when the judging module 11 judges that the Bluetooth information of the second device is not stored in the first device.
[0188] The Bluetooth communication device provided in the embodiments of the present application can execute the scheme shown in the method embodiments, and the implementation principle and beneficial effects are similar, which will not be repeated here.
[0189] In a possible implementation, the judging module 11 is specifically configured to:
[0190] After the first device and the second device establish Bluetooth connection, the first device obtains the device type and configuration information of the second device.
[0191] When the device type of the second device is a preset type and the configuration information indicates that the second device supports Bluetooth information storage function, the first device obtains the device identifier of the second device and judges whether the Bluetooth information of the second device is stored according to the device identifier of the second device.
[0192] In a possible implementation, the judging module 11 is specifically configured to:
[0193] Obtain a storage address.
[0194] Judge whether the Bluetooth information corresponding to the device identifier of the second device is stored in the storage area where the storage address is located.
[0195] If yes, it is determined that the Bluetooth information of the second device is stored in the first device.
[0196] If not, it is determined that the first device does not store the Bluetooth information of the second device.
[0197] In a possible implementation, the judging module 11 is specifically configured to:
[0198] obtain a device identifier set, the device identifier set including device identifiers of a plurality of devices, and the first device storing Bluetooth information of the plurality of devices;
[0199] determine whether the device identifier set includes a device identifier of the second device;
[0200] If yes, it is determined that the first device stores the Bluetooth information of the second device.
[0201] If not, it is determined that the first device does not store the Bluetooth information of the second device.
[0202] Figure 5 Another structural schematic diagram of a Bluetooth communication device is provided in the embodiments of the present application. In the Figure 4 embodiments shown in the drawings, the Bluetooth communication device 10 further includes a third obtaining module 14 and a storage module 15, wherein Figure 5
[0203] The third obtaining module 14 is configured to, after the first obtaining module 12 obtains the Bluetooth information of the second device from the second device, obtain the device type and configuration information of the second device.
[0204] The storage module 15 is configured to, when the device type of the second device is a preset type and the configuration information indicates that the second device supports a Bluetooth information storage function, store the Bluetooth information of the second device.
[0205] In a possible implementation, the storage module 15 is specifically configured to:
[0206] obtain a storage address;
[0207] store the Bluetooth information of the second device in a storage area corresponding to the storage address.
[0208] In a possible implementation, the storage module 15 is specifically configured to:
[0209] obtain a remaining storage space of the storage area;
[0210] If the size of the remaining storage space is greater than or equal to a preset threshold, store the Bluetooth information of the second device in the storage area;
[0211] If the size of the remaining storage space is less than the preset threshold, the first Bluetooth information is deleted from the storage area, and the Bluetooth information of the second device is stored in the storage area.
[0212] In a possible implementation, the storage module 15 is specifically configured to:
[0213] acquire the latest use time of each Bluetooth information in the storage area;
[0214] determine the Bluetooth information with the latest use time as the first Bluetooth information;
[0215] delete the first Bluetooth information from the storage area.
[0216] In a possible implementation, the storage module 15 is further configured to:
[0217] add the device identifier of the second device to the set of device identifiers.
[0218] In a possible implementation, the first device stores the Bluetooth information of the second device; the Bluetooth communication apparatus 10 further includes a receiving module 16 and an updating module 17, wherein,
[0219] the receiving module 16 is configured to receive the updating information sent by the second device;
[0220] the updating module 17 is configured to update the stored Bluetooth information of the second device according to the updating information.
[0221] In a possible implementation, the updating module 17 is specifically configured to:
[0222] if the updating information includes the latest Bluetooth information, the first device updates the stored Bluetooth information of the second device according to the latest Bluetooth information;
[0223] if the updating information does not include the latest Bluetooth information, the first device acquires the latest Bluetooth information from the second device, and the first device updates the stored Bluetooth information of the second device according to the latest Bluetooth information.
[0224] In a possible implementation, the first device updates the stored Bluetooth information of the second device according to the latest Bluetooth information, and the updating module 15 is specifically configured to:
[0225] if the latest Bluetooth information is part of the Bluetooth information of the second device, the first device determines replacement information corresponding to the part of the Bluetooth information in the storage area, and replaces the replacement information with the latest Bluetooth information;
[0226] If the latest Bluetooth information is all Bluetooth information of the second device, the first device replaces the Bluetooth information of the second device in the storage area with the latest Bluetooth information.
[0227] The Bluetooth communication apparatus provided by the embodiments of the present application can execute the scheme shown in the method embodiments, and the implementation principle and beneficial effects are similar, which will not be repeated here.
[0228] Figure 6 The hardware structure diagram of the Bluetooth communication apparatus provided by the embodiments of the present application is provided. Please refer to Figure 6 The Bluetooth communication apparatus 20 can include a processor 21 and a memory 22, wherein the processor 21 and the memory 22 can communicate; for example, the processor 21 and the memory 22 communicate through a communication bus 23, the memory 22 is used to store program instructions, and the processor 21 is used to call the program instructions in the memory to execute the Bluetooth communication method shown in any of the above method embodiments.
[0229] Optionally, the Bluetooth communication apparatus 20 can also include a communication interface, which can include a transmitter and / or a receiver.
[0230] Optionally, the processor can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in the present application can be directly embodied as hardware processor execution, or executed by a combination of hardware and software modules in the processor.
[0231] The present application provides a readable storage medium, and the readable storage medium stores a computer program; the computer program is used to implement the Bluetooth communication method as described in any of the above embodiments.
[0232] The embodiments of the present application provide a computer program product, and the computer program product includes instructions, when the instructions are executed, so that the computer executes the Bluetooth communication method.
[0233] All or part of the steps of the above-mentioned method embodiments can be completed by program instruction related hardware. The aforementioned program can be stored in a readable memory. The program, when executed, performs steps including the above-mentioned method embodiments; and the aforementioned memory (storage medium) includes: a read-only memory (English: read-only memory, abbreviation: ROM), a RAM, a flash memory, a hard disk, a solid state disk, a magnetic tape, a floppy disk (English: floppy disk), an optical disc (English: optical disc), and any combination thereof.
[0234] The embodiments of the present application are described with reference to flowcharts and / or block diagrams according to the methods, devices (systems), and computer program products of the embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of flows and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable terminal equipment processing unit to produce a machine, so that the instructions executed by the computer or other programmable terminal equipment processing unit produce a device implemented in the flowcharts and / or block diagrams. Figure 1 The device that implements the functions specified in one flow or multiple flows and / or blocks. Figure 1 The device that implements the functions specified in one flow or multiple flows and / or blocks.
[0235] These computer program instructions can also be stored in a computer readable memory that can guide the computer or other programmable terminal equipment to work in a specific way, so that the instructions stored in the computer readable memory produce a product including instruction devices that implement the flowcharts and / or block diagrams. Figure 1 The device that implements the functions specified in one flow or multiple flows and / or blocks. Figure 1 The device that implements the functions specified in one flow or multiple flows and / or blocks.
[0236] These computer program instructions can also be loaded into a computer or other programmable terminal equipment, so that a series of operation steps are performed on the computer or other programmable equipment to produce a computer-implemented process, so that the instructions executed on the computer or other programmable equipment provide steps for implementing the flowcharts and / or block diagrams. Figure 1 The device that implements the functions specified in one flow or multiple flows and / or blocks. Figure 1 The device that implements the functions specified in one flow or multiple flows and / or blocks.
[0237] Obviously, those skilled in the art can make various modifications and variations to the embodiments of the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the embodiments of the present application fall within the scope of the claims of the present application and their equivalent technologies, the present application also intends to include these modifications and variations.
[0238] In the present application, the term "comprising" and its variants can refer to non-limiting inclusion; the term "or" and its variants can refer to "and / or". In the present application, the terms "first", "second", etc. are used to distinguish similar objects, and do not necessarily describe a specific order or sequence. In the present application, "multiple" refers to two or more. "And / or", which describes the relationship between the associated objects, means that there can be three relationships, for example, A and / or B can represent: A exists alone, A and B exist together, and B exists alone. The character " / " generally represents a "or" relationship between the front and rear associated objects.
Claims
1. A Bluetooth communication method, characterized by, The method comprises the following steps: After a Bluetooth connection is established between a first device and a second device, the first device acquires device type and configuration information of the second device; When the device type of the second device is a preset type and the configuration information indicates that the second device supports a Bluetooth information storage function, the first device acquires a device identifier of the second device and determines whether the Bluetooth information of the second device is stored in the first device according to the device identifier of the second device; If yes, the first device acquires the Bluetooth information of the second device and performs Bluetooth communication with the second device according to the Bluetooth information of the second device; If no, the first device acquires the Bluetooth information of the second device from the second device and performs Bluetooth communication with the second device according to the Bluetooth information of the second device; After the Bluetooth information of the second device is acquired from the second device, the method further comprises the following steps: The first device acquires the device type and configuration information of the second device; When the device type of the second device is a preset type and the configuration information indicates that the second device supports a Bluetooth information storage function, a storage address is acquired; The remaining storage space of a storage area where the storage address is located is acquired; If the size of the remaining storage space is greater than or equal to a preset threshold, the Bluetooth information of the second device is stored in the storage area; If the size of the remaining storage space is less than the preset threshold, first Bluetooth information is deleted from the storage area, and the Bluetooth information of the second device is stored in the storage area; the first Bluetooth information is Bluetooth information with the most recent use time.
2. The method of claim 1, wherein, The determination whether the Bluetooth information of the second device is stored in the first device according to the device identifier of the second device comprises the following steps: A storage address is acquired; It is determined whether the Bluetooth information corresponding to the device identifier of the second device is stored in a storage area where the storage address is located; If yes, it is determined that the Bluetooth information of the second device is stored in the first device; If no, it is determined that the Bluetooth information of the second device is not stored in the first device.
3. The method of claim 1, wherein, The determination whether the Bluetooth information of the second device is stored in the first device according to the device identifier of the second device comprises the following steps: A device identifier set is acquired, the device identifier set comprising device identifiers of a plurality of devices, and the Bluetooth information of the plurality of devices being stored in the first device; It is determined whether the device identifier of the second device is included in the device identifier set; If yes, it is determined that the Bluetooth information of the second device is stored in the first device; If no, it is determined that the Bluetooth information of the second device is not stored in the first device.
4. The method of claim 1, wherein, The deletion of the first Bluetooth information from the storage area comprises the following steps: The most recent use time of each Bluetooth information in the storage area is acquired; The Bluetooth information with the most recent use time is determined as the first Bluetooth information; The first Bluetooth information is deleted from the storage area.
5. The method according to any one of claims 1 to 4, characterized in that, The method further comprises the following steps: The device identifier of the second device is added to the device identifier set.
6. The method according to any one of claims 1 to 5, characterized in that, The Bluetooth information of the second device is stored in the first device; the method further comprises the following steps: The first device receives update information sent by the second device; The first device updates the stored Bluetooth information of the second device according to the update information.
7. The method of claim 6, wherein, The first device updates the stored Bluetooth information of the second device according to the update information, comprising: If the update information includes the latest Bluetooth information, the first device updates the stored Bluetooth information of the second device according to the latest Bluetooth information; If the update information does not include the latest Bluetooth information, the first device acquires the latest Bluetooth information from the second device, and the first device updates the stored Bluetooth information of the second device according to the latest Bluetooth information.
8. The method of claim 7, wherein, The first device updates the stored Bluetooth information of the second device according to the latest Bluetooth information, comprising: If the latest Bluetooth information is part of the Bluetooth information of the second device, the first device determines replacement information corresponding to the part of the Bluetooth information in a storage area corresponding to the Bluetooth information of the second device, and replaces the replacement information with the latest Bluetooth information; If the latest Bluetooth information is all of the Bluetooth information of the second device, the first device replaces the Bluetooth information of the second device in the storage area with the latest Bluetooth information.
9. A Bluetooth communication device, characterized in that The device comprises a judging module, a first acquiring module, a second acquiring module, a third acquiring module and a storage module, wherein: The judging module is configured to, after the first device establishes a Bluetooth connection with the second device, acquire the device type and configuration information of the second device; when the device type of the second device is a preset type and the configuration information indicates that the second device supports a Bluetooth information storage function, the first device acquires the device identifier of the second device, and determines whether the Bluetooth information of the second device is stored according to the device identifier of the second device; The first acquiring module is configured to, when the judging module determines that the Bluetooth information of the second device is stored in the first device, acquire the Bluetooth information of the second device in the first device, and performs Bluetooth communication with the second device according to the Bluetooth information of the second device; The second acquiring module is configured to, when the judging module determines that the Bluetooth information of the second device is not stored in the first device, acquire the Bluetooth information of the second device from the second device, and performs Bluetooth communication with the second device according to the Bluetooth information of the second device; The third acquiring module is configured to, after the first acquiring module acquires the Bluetooth information of the second device from the second device, acquire the device type and configuration information of the second device; The storage module is configured to, when the device type of the second device is a preset type and the configuration information indicates that the second device supports a Bluetooth information storage function, acquire a storage address; acquire the remaining storage space of a storage area where the storage address is located; If the size of the remaining storage space is greater than or equal to a preset threshold, store the Bluetooth information of the second device in the storage area; If the size of the remaining storage space is less than the preset threshold, deleting first Bluetooth information in the storage area and storing Bluetooth information of the second device in the storage area; the first Bluetooth information is the Bluetooth information with the most recent use time.
10. A Bluetooth communication device, characterized in that Comprising: a processor and a memory; the memory stores computer-executed instructions; the processor executes the computer-executed instructions stored in the memory, so that the processor executes the Bluetooth communication method as claimed in any one of claims 1 to 8.
11. A computer readable storage medium, characterized in that, The computer-readable storage medium stores computer-executed instructions, and when the processor executes the computer-executed instructions, the Bluetooth communication method as claimed in any one of claims 1 to 8 is realized.
12. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to realize the Bluetooth communication method as claimed in any one of claims 1 to 8.
Citation Information
Patent Citations
Method and device for processing bluetooth pairing information
CN103228060A
Data transmission method, data transmission device and electronic equipment
CN111328059A
Bluetooth communication method and device and computer readable storage medium
CN111741457A
Bluetooth protocol connection method and device, storage medium and related equipment
CN113810887A