Method and device for determining service provided by server, bluetooth device and storage medium

By comparing the unique identifier and hash value of the Bluetooth device server, the problem of redundant data interaction caused by random changes in the server's broadcast address is solved, and efficient GATT service connection is achieved in low-power Bluetooth devices.

CN115226086BActive Publication Date: 2026-01-30GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210674724.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-14
Publication Date
2026-01-30
Estimated Expiration
2042-06-14

AI Technical Summary

Technical Problem

In Bluetooth devices, the existing database hashing function can only be used when the server broadcast address is a public address. It cannot work effectively when the broadcast address changes randomly, resulting in redundant data exchange and slow connection speed.

Method used

By obtaining the server's unique identifier and current hash value, a unique identifier is calculated using AES-CMAC, MD5, or SHA algorithms and compared with the historical hash values ​​stored locally. If they match, the search for services provided by the server is stopped; otherwise, the search continues, thus optimizing the connection process.

Benefits of technology

When the server-side broadcast address changes randomly, the database hash feature of the GATT service is implemented, which reduces redundant data interaction and optimizes the connection speed of the device.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115226086B_ABST
    Figure CN115226086B_ABST
Patent Text Reader

Abstract

This application discloses a method, apparatus, Bluetooth device, and storage medium for determining whether a server provides services. This allows for the implementation of a database hash feature value function for a generic attribute protocol service even when the server's broadcast address on a low-power Bluetooth device is a random address, thereby reducing redundant data interaction and optimizing device connection speed. The method includes: when the Bluetooth device connects to a server, if the server's broadcast address is a random address, obtaining the server's unique identifier and current hash value; searching for locally stored historical hash values ​​based on the unique identifier; if the current hash value and the historical hash value are consistent, determining that the service provided by the server has not changed, and stopping the search for the service provided by the server.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of Bluetooth technology, and in particular to a method, apparatus, Bluetooth device, and storage medium for determining whether a server provides services. Background Technology

[0002] In the existing Bluetooth core protocol, the Database Hash function can only be used when the server broadcast address is a public address. If the broadcaster uses a random address, this function cannot be used because the broadcast address changes every time a broadcast is re-initiated. Summary of the Invention

[0003] This application provides a method, apparatus, Bluetooth device, and storage medium for determining whether a server is providing services. This allows the database hash feature value function of the general attribute protocol service to be implemented even when the server broadcast address of the low-power Bluetooth device is a random address, thereby reducing redundant data interaction and optimizing the connection speed of the device.

[0004] The first aspect of this application provides a method for determining whether a server is providing services, which may include:

[0005] When a Bluetooth device connects to a server, if the server's broadcast address is a random address, then the server's unique identifier and current hash value are obtained.

[0006] Based on the unique identifier, locate the locally stored historical hash value;

[0007] If the current hash value is consistent with the historical hash value, it is determined that the service provided by the server has not changed, and the search for the service provided by the server is stopped.

[0008] A second aspect of this application provides an apparatus for determining whether a server is providing services, which may include:

[0009] The acquisition module is used to acquire the unique identifier and current hash value of the server when the Bluetooth device connects to the server, if the broadcast address of the server is a random address;

[0010] The processing module is used to look up the locally stored historical hash value based on the unique identifier; if the current hash value and the historical hash value are consistent, it is determined that the service provided by the server has not changed, and the search for the service provided by the server is stopped.

[0011] A third aspect of this application provides a Bluetooth device that may include:

[0012] Memory containing executable program code;

[0013] A processor coupled to the memory;

[0014] The processor is used to execute the method described in the first aspect of this application.

[0015] In another aspect, embodiments of this application provide a computer-readable storage medium including instructions that, when executed on a processor, cause the processor to perform the method described in the first aspect of this application.

[0016] Another aspect of this application discloses a computer program product that, when run on a computer, causes the computer to execute the method described in the first aspect of this application.

[0017] Another aspect of this application discloses an application publishing platform for publishing computer program products, wherein when the computer program product is run on a computer, the computer executes the method described in the first aspect of this application.

[0018] As can be seen from the above technical solutions, the embodiments of this application have the following advantages:

[0019] In this embodiment, when a Bluetooth device connects to a server, if the server's broadcast address is a random address, the unique identifier and current hash value of the server are obtained. Based on the unique identifier, the locally stored historical hash value is searched. If the current hash value and the historical hash value are consistent, it is determined that the service provided by the server has not changed, and the search for the service provided by the server is stopped. This allows the Bluetooth device to obtain the server's unique identifier and current hash value when the server's broadcast address is a random address. The unique identifier can be used to find the locally stored historical hash value on the Bluetooth device. If the current hash value and the historical hash value are consistent, it is considered that the service provided by the server has not changed, and there is no need to search for the service provided by the server; the service provided by the server can be used directly. That is, even when the broadcast address of the Bluetooth Low Energy (BLE) device server is a random address, the Database Hash characteristic function of the General Attribute Protocol Service (GATT) can still be implemented, thereby reducing redundant data interaction and optimizing the device's connection speed. Attached Figure Description

[0020] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments and the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application, and other drawings can be obtained based on these drawings.

[0021] Figure 1A schematic diagram illustrating an embodiment of the method for determining a server to provide services in this application;

[0022] Figure 2 This is a schematic diagram of another embodiment of the method for determining the service provider in this application.

[0023] Figure 3 A flowchart illustrating the method for determining the service provider in this application embodiment;

[0024] Figure 4 A schematic diagram of an apparatus for determining a server to provide services in an embodiment of this application;

[0025] Figure 5 This is a schematic diagram of one embodiment of the Bluetooth device described in this application.

[0026] Figure 6 This is a schematic diagram of another embodiment of the Bluetooth device in this application. Detailed Implementation

[0027] This application provides a method, apparatus, Bluetooth device, and storage medium for determining whether a server is providing services. This allows the database hash feature value function of the general attribute protocol service to be implemented even when the server broadcast address of the low-power Bluetooth device is a random address, thereby reducing redundant data interaction and optimizing the connection speed of the device.

[0028] To enable those skilled in the art to better understand the present application, the technical solutions of the embodiments of the present application will be described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. All embodiments based on the present application should fall within the scope of protection of the present application.

[0029] The following is a brief explanation of several technical terms used in this application:

[0030] 1. profile

[0031] A profile can be understood as a specification, a standard communication protocol, that exists in both the master and slave devices. The Bluetooth organization defines some standard profiles, such as HID OVER GATT, anti-loss devices, and heart rate monitors. Each profile contains multiple services, and each service represents a capability of the slave device (server).

[0032] 2. service

[0033] A service can be understood as a single service. In Bluetooth Low Energy (BLE) slave devices, there are multiple services, such as power information service and system information service. Each service contains multiple characteristics. Each specific characteristic is the subject of BLE communication. For example, if the current battery level is 80%, the battery level characteristic will be stored in the slave device's profile. This allows the master device to read the 80% data using this characteristic.

[0034] 3. Characteristic

[0035] Characteristic values ​​are used for communication between BLE master and slave devices. They can be understood as tags, through which desired content can be obtained or written.

[0036] 4. UUID

[0037] UUID, Universally Unique Identifier, is used to identify the services and characteristics mentioned above. Each slave device has a profile, whether it's the custom simple profile or the standard anti-loss device profile. It consists of a series of services, and each service contains multiple characteristics. Communication between the master and slave devices is achieved through these characteristics.

[0038] Currently, Bluetooth Low Energy (BLE) connections are built on the Generic Attribute Profile (GATT). GATT is a universal specification for sending and receiving short data segments called attributes over Bluetooth connections. It defines how two BLE devices communicate through things called services and characteristics. GATT uses the Attribute Protocol (ATT), which stores the data corresponding to services and characteristics in a lookup table. This lookup table uses a 16-bit ID as the index for each entry.

[0039] Once a connection is established between two devices, GATT becomes active, which means that the Generic Access Profile (GAP) must be completed beforehand. It's important to note that a GATT connection requires prior processing via the GAP protocol. In Android development, however, a connection can be initiated directly using the device's Media Access Control (MAC) address, bypassing the scanning step. This doesn't mean the GAP is unnecessary; it's actually handled at the chip level. Bluetooth chips always scan for devices before initiating a connection.

[0040] A crucial point to note about GATT connections is that they are exclusive. This means that a BLE peripheral can only be connected to one central device at a time. Once a peripheral is connected, it immediately stops broadcasting, making it invisible to other devices. It resumes broadcasting when the device is disconnected.

[0041] If the central device and peripheral devices need to communicate bidirectionally, the only way is to establish a GATT connection.

[0042] GATT communication operates on a client / server (C / S) relationship. The peripheral device acts as the GATT server, maintaining the ATT lookup table and defining services and characteristics. The central device is the GATT client, initiating requests to the server. It's important to note that all communication events are initiated by the client (also called the master device) and receive responses from the server (also called the slave device).

[0043] Once a connection is established, the peripheral device will suggest a connection interval to the central device. The central device will then attempt to reconnect during each connection interval to check for new data. However, this connection interval is only a suggestion, and the central device may not strictly adhere to it, for example, if it is busy connecting to other peripheral devices or if its resources are too heavy.

[0044] In the existing Bluetooth core protocol, the Database Hash function can only be used when the server broadcast address is a public address. If the broadcaster uses a random address, this function cannot be used because the broadcast address changes every time a broadcast is re-initiated.

[0045] In this application embodiment, any electronic device with Bluetooth functionality can be referred to as a Bluetooth device. For example, a terminal device with Bluetooth functionality. The terminal device can be referred to as user equipment (UE), mobile station (MS), mobile terminal, smart terminal, etc., and can communicate with one or more core networks via a radio access network (RAN). For example, a terminal device can be a mobile phone (or "cellular" phone), a computer with a mobile terminal, etc. Terminal devices can also be portable, pocket-sized, handheld, computer-embedded, or vehicle-mounted mobile devices, as well as terminal devices in future New Radio (NR) networks, which exchange voice or data with the radio access network. Note on terminal devices: In this application, terminal devices can also include relays and base stations capable of data communication; these can all be considered terminal devices. This application will use the general term UE for description.

[0046] In the embodiments of this application, the terminal device may be a mobile phone, a tablet computer, a computer with wireless transceiver capabilities, a virtual reality (VR) terminal device, an augmented reality (AR) terminal device, a wireless terminal device in industrial control, a wireless terminal device in self-driving, a wireless terminal device in remote medical care, a wireless terminal device in a smart grid, a wireless terminal device in transportation safety, a wireless terminal device in a smart city, or a wireless terminal device in a smart home, etc.

[0047] By way of example and not limitation, in this embodiment, the terminal device can also be a wearable device. Wearable devices, also known as wearable smart devices, are a general term for devices that utilize wearable technology to intelligently design and develop everyday wearables, such as glasses, gloves, watches, clothing, and shoes. Wearable devices are portable devices that are worn directly on the body or integrated into the user's clothing or accessories. Wearable devices are not merely hardware devices, but also achieve powerful functions through software support, data interaction, and cloud interaction. Broadly speaking, wearable smart devices include those that are feature-rich, large in size, and can achieve complete or partial functions without relying on a smartphone, such as smartwatches or smart glasses, as well as those that focus on a specific type of application function and require the use of other devices such as smartphones, such as various smart bracelets and smart jewelry for vital sign monitoring.

[0048] In existing implementations, the client (Bluetooth device) stores the server's GATT services and Database Hash characteristic values ​​via the server's address. Therefore, if the server's address is random, the client perceives each connection as a new device because the server's address changes with each broadcast. This renders the functionality meaningless and could lead to the client storing excessive service data.

[0049] To address the problems described above, this invention provides a way to achieve the Database Hash characteristic function of GATT services even when BLE devices broadcast using random addresses. When the server address changes, causing a Bluetooth device to reconnect to the server, it can identify whether the server's GATT services have been modified, thereby optimizing connection speed.

[0050] Understandably, the Database Hash characteristic of a Bluetooth Low Energy (BLE) GATT service is used to identify whether GATT services on the server have been added, deleted, or modified. In this embodiment, the value of the Database Hash characteristic is a current hash value calculated based on the services defined in the GATT database using the AES-CMAC algorithm of the RFC-4493 protocol. The client reads and determines whether this current hash value is the same as the historical hash value of the same service stored locally, thereby determining whether the services on the server have been modified, and thus deciding whether to re-execute the service discovery process.

[0051] This application provides a database hash characteristic function for Generic Attribute Profile (GATT) services even when BLE devices broadcast using random addresses. When the server address changes, causing the client to reconnect to the server, it can identify whether the server's GATT services have been modified, thereby optimizing connection speed and reducing device power consumption.

[0052] The technical solution of this application will be further described below by way of embodiments, such as... Figure 1 The diagram shown is an embodiment of a method for determining a server to provide services, as described in this application. It may include:

[0053] 101. When a Bluetooth device connects to a server, if the server's broadcast address is a random address, then obtain the server's unique identifier and current hash value.

[0054] Optionally, when a Bluetooth device connects to a server, if the server's broadcast address is a random address, obtaining the server's unique identifier can be implemented in several ways, including but not limited to the following:

[0055] Implementation Method 1: When a Bluetooth device connects to a server, if the server's broadcast address is a random address, then the unique identifier of the server is obtained based on the AES-CMAC (Advanced Encryption Standard-Cipher based Message Authentication Code) algorithm, a preset public key, and the server's broadcast address.

[0056] Optionally, obtaining the unique identifier of the server based on the AES-CMAC algorithm, a preset public key, and the server's broadcast address may include:

[0057] According to the first formula, obtain the unique identifier of the server;

[0058] The first formula is Uid = AES - CMAC K (PAddr) / mod2 36 ;

[0059] Where Uid is the unique identifier of the server, AES-CMAC is the algorithm for calculating the hash, K is the preset public key, PAddr is the public address of the server, and mod2 36 This indicates that the lower 36 bits of the result are retrieved.

[0060] Implementation Method 2: When a Bluetooth device connects to a server, if the server's broadcast address is a random address, then the unique identifier of the server is obtained based on the MD5 Message-Digest Algorithm, a preset public key, and the server's broadcast address.

[0061] Optionally, obtaining the unique identifier of the server based on the MD5 message digest algorithm, a preset public key, and the server's broadcast address may include:

[0062] According to the second formula, obtain the unique identifier of the server;

[0063] The second formula is Uid = MD5 K (PAddr) / mod2 36 ;

[0064] Where Uid is the unique identifier of the server, MD5 is the algorithm for calculating the hash, K is the preset public key, PAddr is the public address of the server, and mod2 36 This indicates that the lower 36 bits of the result are retrieved.

[0065] Understandably, the MD5 message digest algorithm calculates a 128-bit "fingerprint" or "message digest" from input information of arbitrary length. It is computationally impossible to assume that two different files will produce the same message digest or that the original information can be generated from a given message digest.

[0066] MD5 stands for Message-Digest Algorithm 5. MD5 is an irreversible algorithm, meaning that the generated ciphertext can be inverted infinitely many times. Developed in the early 1990s, it evolved from MD2, MD3, and MD4. Its purpose is to "compress" large amounts of information into a secure format (transforming an arbitrary-length byte string into a fixed-length large integer) before signing it with a private key using digital signature software.

[0067] Implementation Method 3: When a Bluetooth device connects to a server, if the server's broadcast address is a random address, then the unique identifier of the server is obtained based on the Secure Hash Algorithm (SHA), the preset public key, and the server's broadcast address.

[0068] Optionally, obtaining the unique identifier of the server based on the Secure Hash (SHA) algorithm, a preset public key, and the server's broadcast address may include:

[0069] The third formula is Uid = SHA K (PAddr) / mod2 36 ;

[0070] Where Uid is the unique identifier of the server, SHA is the algorithm for calculating the hash, K is the preset public key, PAddr is the public address of the server, and mod2 36 This indicates that the lower 36 bits of the result are retrieved.

[0071] As is understandable, a Secure Hash Algorithm (SHA) is a family of cryptographic hash functions, specifically a FIPS-certified secure hash algorithm. It's an algorithm that can compute a fixed-length string (also known as a message digest) corresponding to a numerical message. Furthermore, there's a high probability that different input messages will correspond to different strings.

[0072] Optionally, when a Bluetooth device connects to a server, if the server's broadcast address is a random address, obtaining the server's unique identifier and current hash value may include: when a Bluetooth device connects to a server, if the server's broadcast address is a random address, reading the attribute value of the server's database hash feature value; and obtaining the server's unique identifier and current hash value based on the attribute value of the server's database hash feature value.

[0073] 102. Based on the unique identifier, find the locally stored historical hash value.

[0074] Optionally, the unique identifier is added to the attribute value of the database hash feature value on the server side.

[0075] Optionally, the size of the unique identifier is 36 bits.

[0076] For example, in the Database Hash characteristic value declaration format, the attribute value field adds a 36-bit unique identification field based on the Bluetooth Special Interest Group (SIG) protocol. This field can be obtained by the HASH operation shown in formula (1) and can uniquely identify a device, and it remains unchanged throughout the device's life cycle.

[0077] The declaration format for a database hash characteristic is shown in Table 1:

[0078]

[0079] Table 1

[0080] In existing technologies, the storage space for attribute values ​​is 128 bits, all of which is used to store database hashes. In this embodiment, the storage space for database hashes is compressed to 92 bits, and the remaining 36 bits of the attribute value are used to store unique identifiers. Therefore, it is also compatible with existing protocols.

[0081] Uid = AES-CMAC K (PAddr) / mod2 36 Formula (1)

[0082] Among them, Uid: a 36-bit unique identifier;

[0083] AES-CMAC: The hash calculation algorithm specified in RFC-4493;

[0084] K: 128-bit public key, which can be all zeros (0x00000000_00000000_00000000_00000000);

[0085] PAddr: The device's public address;

[0086] mod2 36 This indicates that the lower 36 bits of the result are retrieved.

[0087] 103. If the current hash value and the historical hash value are consistent, it is determined that the service provided by the server has not changed, and the search for the service provided by the server is stopped.

[0088] For example, when a Bluetooth device connects to a server, it reads the Attribute Value of the server's Database Hashcharacteristic to obtain the server's Uid field and the current HASH value. The Uid identifies the server, and then it checks if the services provided by the server have changed. Specifically, it looks up the corresponding historical HASH value stored locally using the Uid. If the current HASH value and the historical HASH value are the same, it means that the services provided by the server have not changed, and there is no need to continue the process of looking up the services provided by the server. The device can directly use the services provided by the server, thus saving the process of looking up the services provided by the server and reducing redundant data interaction.

[0089] In this embodiment, when a Bluetooth device connects to a server, if the server's broadcast address is a random address, the unique identifier and current hash value of the server are obtained. Based on the unique identifier, the locally stored historical hash value is searched. If the current hash value and the historical hash value are consistent, it is determined that the service provided by the server has not changed, and the search for the service provided by the server is stopped. This allows the Bluetooth device to obtain the server's unique identifier and current hash value when the server's broadcast address is a random address. The unique identifier can be used to find the locally stored historical hash value on the Bluetooth device. If the current hash value and the historical hash value are consistent, it is considered that the service provided by the server has not changed, and there is no need to search for the service provided by the server; the service provided by the server can be used directly. That is, even when the broadcast address of the Bluetooth Low Energy (BLE) device server is a random address, the Database Hash characteristic function of the General Attribute Protocol Service (GATT) can still be implemented, thereby reducing redundant data interaction and optimizing the device's connection speed.

[0090] like Figure 2 The diagram shown is a schematic representation of another embodiment of the method for determining the service provider in this application, which may include:

[0091] 201. When a Bluetooth device connects to a server, if the server's broadcast address is a random address, then obtain the server's unique identifier and current hash value.

[0092] 202. Based on the unique identifier, find the locally stored historical hash value.

[0093] 203. If the current hash value and the historical hash value are consistent, it is determined that the service provided by the server has not changed, and the search for the service provided by the server is stopped.

[0094] It should be noted that steps 201-203 in the embodiments of this application are different from those in the present application. Figure 1 Steps 101-103 in the illustrated embodiment are similar and will not be repeated here.

[0095] Optionally, the method may further include: after the Bluetooth device stops searching for the services provided by the server, the Bluetooth device may directly use the services provided by the server.

[0096] 204. If the current hash value and the historical hash value are inconsistent, it is determined that the service provided by the server has changed, and the search for the service provided by the server continues.

[0097] For example, if the current hash value is different from the historical hash value, it means that the services provided by the server have changed, and the process of finding the services provided by the server continues.

[0098] 205. Add the current hash value to the historical hash value, and save the added historical hash value in the cache.

[0099] For example, the current hash value is added to the historical hash value, and the added historical hash value is saved in the cache. The added historical hash value serves as the hash value corresponding to the updated service provided by the server, and is used the next time the Bluetooth device connects to the server.

[0100] like Figure 3 The diagram shown is a flowchart illustrating the method for determining the service provider in an embodiment of this application. The problem addressed by this application is to implement the Database Hash characteristic function of the GATT service when the BLE device server's broadcast address is a random address, thereby optimizing connection speed.

[0101] In this embodiment, when a Bluetooth device connects to a server, if the server's broadcast address is a random address, the unique identifier and current hash value of the server are obtained. Based on the unique identifier, the locally stored historical hash value is searched. If the current hash value and the historical hash value are consistent, it is determined that the service provided by the server has not changed, and the search for the service provided by the server is stopped. If the current hash value and the historical hash value are inconsistent, it is determined that the service provided by the server has changed, and the search for the service provided by the server continues. This allows the Bluetooth device to obtain the server's unique identifier and current hash value when connecting to a server, if the server's broadcast address is a random address. The unique identifier can be used to find the locally stored historical hash value on the Bluetooth device. If the current hash value and the historical hash value are consistent, it is considered that the service provided by the server has not changed, and the service provided by the server can be used directly without searching for it. If the current hash value and the historical hash value are inconsistent, it is considered that the service provided by the server has changed, and the service provided by the server needs to be searched. Even when the server broadcast address of a Bluetooth Low Energy (BLE) device is a random address, the Database Hash characteristic function of the General Attribute Protocol Service (GATT) can still be implemented, thereby reducing redundant data interaction and optimizing the device's connection speed.

[0102] like Figure 4 The diagram shown is a schematic representation of an apparatus for determining the service provider in an embodiment of this application, which may include:

[0103] The acquisition module 401 is used to acquire the unique identifier and current hash value of the server when the Bluetooth device connects to the server and the broadcast address of the server is a random address.

[0104] The processing module 402 is used to search for the locally stored historical hash value based on the unique identifier; if the current hash value and the historical hash value are consistent, it is determined that the service provided by the server has not changed, and the search for the service provided by the server is stopped.

[0105] Optionally, the acquisition module 401 is specifically used to obtain the unique identifier of the server based on the AES-CMAC algorithm, a preset public key, and the broadcast address of the server; or,

[0106] The acquisition module 401 is specifically used to obtain the unique identifier of the server based on the MD5 message digest algorithm, the preset public key, and the broadcast address of the server; or,

[0107] The acquisition module 401 is specifically used to obtain the unique identifier of the server based on the secure hash SHA algorithm, the preset public key and the broadcast address of the server.

[0108] Optionally, the acquisition module 401 is specifically used to acquire the unique identifier of the server according to the first formula;

[0109] The first formula is Uid = AES - CMAC K (PAddr) / mod2 36 ;

[0110] The acquisition module 401 is specifically used to acquire the unique identifier of the server according to the second formula;

[0111] The second formula is Uid = MD5 K (PAddr) / mod2 36 ;

[0112] The acquisition module 401 is specifically used for the third formula Uid = SHA. K (PAddr) / mod2 36 ;

[0113] Where Uid is the unique identifier of the server, AES-CMAC, MD5, and SHA are the algorithms for calculating the hash, K is the preset public key, PAddr is the public address of the server, and mod2 36 This indicates that the lower 36 bits of the result are retrieved.

[0114] Optionally, the unique identifier is added to the attribute value of the database hash feature value on the server side.

[0115] Optionally, the acquisition module 401 is specifically used to, when the Bluetooth device connects to the server, if the broadcast address of the server is a random address, read the attribute value of the database hash feature value of the server; and obtain the unique identifier and current hash value of the server based on the attribute value of the database hash feature value of the server.

[0116] Optionally, the processing module 402 is further configured to determine that the service provided by the server has changed if the current hash value and the historical hash value are inconsistent, and continue to search for the service provided by the server.

[0117] Optionally, the processing module 402 is further configured to add the current hash value to the historical hash value and save the added historical hash value in a cache.

[0118] like Figure 5 The diagram shown is a schematic representation of an embodiment of a Bluetooth device in this application, which may include: Figure 4 The apparatus shown is for determining the service provided by the server.

[0119] like Figure 6 The diagram shown is a schematic representation of another embodiment of the Bluetooth device in this application, which may include:

[0120] Figure 6 This diagram illustrates a partial structural design of a mobile phone related to the Bluetooth device provided in this embodiment. (Reference) Figure 6 The mobile phone includes components such as a radio frequency (RF) circuit 610, a memory 620, an input unit 630, a display unit 640, a sensor 650, an audio circuit 660, a wireless fidelity (Wi-Fi) module 670, a processor 680, and a power supply 690. Those skilled in the art will understand that... Figure 6 The mobile phone structure shown does not constitute a limitation on the mobile phone and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0121] The following is combined with Figure 6 A detailed introduction to each component of a mobile phone:

[0122] RF circuit 610 can be used for receiving and transmitting signals during information transmission or calls. Specifically, it receives downlink information from the base station and processes it with processor 680; additionally, it transmits uplink data to the base station. Typically, RF circuit 610 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low-noise amplifier (LNA), a duplexer, etc. Furthermore, RF circuit 610 can also communicate wirelessly with networks and other devices. The aforementioned wireless communication can use any communication standard or protocol, including but not limited to Global System for Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, Short Messaging Service (SMS), etc.

[0123] The memory 620 can be used to store software programs and modules. The processor 680 executes various functions and data processing of the mobile phone by running the software programs and modules stored in the memory 620. The memory 620 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, applications required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the mobile phone (such as audio data, phonebook, etc.). In addition, the memory 620 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.

[0124] The input unit 630 can be used to receive input numerical or character information, and to generate key signal inputs related to user settings and function control of the mobile phone. Specifically, the input unit 630 may include a touch panel 631 and other input devices 632. The touch panel 631, also known as a touch screen, can collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel 631), and drive the corresponding connection devices according to a pre-set program. Optionally, the touch panel 631 may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch position and the signal generated by the touch operation, and transmits the signal to the touch controller; the touch controller receives touch information from the touch detection device, converts it into touch point coordinates, sends it to the processor 680, and can receive and execute commands sent by the processor 680. In addition, the touch panel 631 can be implemented using various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch panel 631, the input unit 630 may also include other input devices 632. Specifically, other input devices 632 may include, but are not limited to, one or more of the following: physical keyboard, function keys (such as volume control buttons, power buttons, etc.), trackball, mouse, joystick, etc.

[0125] The display unit 640 can be used to display information input by the user or information provided to the user, as well as various menus of the mobile phone. The display unit 640 may include a display panel 641, which may optionally be configured as a liquid crystal display (LCD), organic light-emitting diode (OLED), or similar display. Furthermore, a touch panel 631 may cover the display panel 641. When the touch panel 631 detects a touch operation on or near it, it transmits the information to the processor 680 to determine the type of touch event. Subsequently, the processor 680 provides corresponding visual output on the display panel 641 based on the type of touch event. Although in Figure 6 In this embodiment, the touch panel 631 and the display panel 641 are two separate components to realize the input and output functions of the mobile phone. However, in some embodiments, the touch panel 631 and the display panel 641 can be integrated to realize the input and output functions of the mobile phone.

[0126] The mobile phone may also include at least one sensor 650, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor. The ambient light sensor can adjust the brightness of the display panel 641 according to the ambient light level, and the proximity sensor can turn off the display panel 641 and / or backlight when the phone is moved to the ear. As a type of motion sensor, an accelerometer sensor can detect the magnitude of acceleration in various directions (generally three axes). When stationary, it can detect the magnitude and direction of gravity, and can be used for applications that recognize the phone's posture (such as landscape / portrait switching, related games, magnetometer posture calibration), vibration recognition-related functions (such as pedometer, taps), etc. Other sensors that may be configured in the mobile phone, such as gyroscopes, barometers, hygrometers, thermometers, and infrared sensors, will not be described in detail here.

[0127] Audio circuit 660, speaker 661, and microphone 662 provide an audio interface between the user and the mobile phone. Audio circuit 660 converts received audio data into electrical signals and transmits them to speaker 661, where speaker 661 converts them into sound signals for output. On the other hand, microphone 662 converts collected sound signals into electrical signals, which are received by audio circuit 660, converted into audio data, and then output to processor 680 for processing. The audio data is then transmitted via RF circuit 610 to, for example, another mobile phone, or output to memory 620 for further processing.

[0128] Wi-Fi is a short-range wireless transmission technology. Through the Wi-Fi module 670, mobile phones can help users send and receive emails, browse web pages, and access streaming media, providing users with wireless broadband internet access. Although Figure 6The Wi-Fi module 670 is shown, but it is understood that it is not a necessary component of the mobile phone and can be omitted as needed without changing the nature of the application.

[0129] The processor 680 is the control center of the mobile phone, connecting various parts of the phone through various interfaces and lines. It executes software programs and / or modules stored in the memory 620, and calls data stored in the memory 620 to perform various functions and process data, thereby providing overall monitoring of the phone. Optionally, the processor 680 may include one or more processing units; preferably, the processor 680 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may also not be integrated into the processor 680.

[0130] The mobile phone also includes a power supply 690 (such as a battery) that supplies power to various components. Preferably, the power supply can be logically connected to the processor 680 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system.

[0131] Although not shown, mobile phones may also include a camera, Bluetooth module, etc., which will not be described in detail here.

[0132] In this embodiment of the application, the processor 680 is configured to, when a Bluetooth device connects to a server, if the broadcast address of the server is a random address, obtain the unique identifier and current hash value of the server.

[0133] The processor 680 is used to look up the locally stored historical hash value based on the unique identifier; if the current hash value and the historical hash value are consistent, it is determined that the service provided by the server has not changed, and the search for the service provided by the server is stopped.

[0134] Optionally, the processor 680 is specifically configured to obtain the unique identifier of the server based on the AES-CMAC algorithm, a preset public key, and the broadcast address of the server; or,

[0135] Processor 680 is specifically configured to obtain the unique identifier of the server based on the MD5 message digest algorithm, a preset public key, and the broadcast address of the server; or,

[0136] The processor 680 is specifically used to obtain the unique identifier of the server based on the secure hash SHA algorithm, a preset public key, and the broadcast address of the server.

[0137] Optionally, the processor 680 is specifically used to obtain the unique identifier of the server according to the first formula;

[0138] The first formula is Uid = AES - CMAC K (PAddr) / mod2 36 ;

[0139] The processor 680 is specifically used to obtain the unique identifier of the server according to the second formula;

[0140] The second formula is Uid = MD5 K (PAddr) / mod2 36 ;

[0141] Processor 680, specifically used in the third formula Uid = SHA K (PAddr) / mod2 36 ;

[0142] Where Uid is the unique identifier of the server, AES-CMAC, MD5, and SHA are the algorithms for calculating the hash, K is the preset public key, PAddr is the public address of the server, and mod2 36 This indicates that the lower 36 bits of the result are retrieved.

[0143] Optionally, the unique identifier is added to the attribute value of the database hash feature value on the server side.

[0144] Optionally, the processor 680 is specifically configured to, when a Bluetooth device connects to a server, if the broadcast address of the server is a random address, read the attribute value of the database hash feature value of the server; and obtain the unique identifier and current hash value of the server based on the attribute value of the database hash feature value of the server.

[0145] Optionally, the processor 680 is further configured to determine that the service provided by the server has changed if the current hash value and the historical hash value are inconsistent, and continue to search for the service provided by the server.

[0146] Optionally, the processor 680 is also configured to add the current hash value to the historical hash value and save the added historical hash value in a cache.

[0147] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can store or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state disk (SSD)).

[0148] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0149] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between apparatuses or units through some interfaces, and may be electrical, mechanical, or other forms.

[0150] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0151] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0152] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0153] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.

Claims

1. A method for determining a service provided by a server, characterized in that, The method comprises the following steps: When a Bluetooth device connects to a service end, if the broadcast address of the service end is a random address, the unique identifier and the current hash value of the service end are obtained, the unique identifier is added in the attribute value of the database hash feature value of the service end, and the unique identifier is unchanged in the device life cycle; According to the unique identifier, the historical hash value of the same service end saved locally is searched; If the current hash value is consistent with the historical hash value, it is determined that the service provided by the service end has not changed, and the search for the service provided by the service end is stopped.

2. The method of claim 1, wherein, The unique identifier of the service end is obtained by the following methods: According to the AES-CMAC algorithm, the preset public key and the broadcast address of the service end, the unique identifier of the service end is obtained; or, According to the MD5 information digest algorithm, the preset public key and the broadcast address of the service end, the unique identifier of the service end is obtained; or, According to the secure hash SHA algorithm, the preset public key and the broadcast address of the service end, the unique identifier of the service end is obtained.

3. The method of claim 2, wherein, The unique identifier of the service end is obtained by the following methods: According to the first formula, the unique identifier of the service end is obtained; The first formula is ; The unique identifier of the service end is obtained by the following methods: According to the second formula, the unique identifier of the service end is obtained; The second formula is ; The unique identifier of the service end is obtained by the following methods: According to the third formula, the unique identifier of the service end is obtained; The third formula is ; wherein, is a unique identifier of the service end, , , is an algorithm for calculating a hash HASH, K is a preset public key, is a broadcast address of the service end, represents the low 36 bits of the result.

4. The method according to any one of claims 1 to 3, characterized in that, When a Bluetooth device connects to a service end, if the broadcast address of the service end is a random address, the unique identifier and the current hash value of the service end are obtained, the unique identifier is added in the attribute value of the database hash feature value of the service end, and the unique identifier is unchanged in the device life cycle. The method further comprises the following steps: If the current hash value is inconsistent with the historical hash value, it is determined that the service provided by the service end has changed, and the search for the service provided by the service end is continued.

5. The method according to any one of claims 1-3, characterized in that, The method further comprises the following steps: The current hash value is added in the historical hash value, and the added historical hash value is saved in the cache.

6. The method of claim 5, wherein, The method comprises the following steps: An acquisition module is configured to, when a Bluetooth device connects to a service end, if the broadcast address of the service end is a random address, acquire the unique identifier and the current hash value of the service end, the unique identifier is added in the attribute value of the database hash feature value of the service end, and the unique identifier is unchanged in the device life cycle; 7. An apparatus for determining a service provided by a server, the apparatus comprising: A processing module is configured to, according to the unique identifier, search the historical hash value of the same service end saved locally, and if the current hash value is consistent with the historical hash value, it is determined that the service provided by the service end has not changed, and the search for the service provided by the service end is stopped. The method comprises the following steps: A memory storing executable program codes; 8. A Bluetooth device, characterized in that ​ ​ a processor coupled to the memory and a display; the processor and the display are respectively configured to perform the method of any one of claims 1-6.

9. A computer readable storage medium comprising instructions which, when executed on a processor, cause the processor to perform the method of any one of claims 1-6.

Citation Information

Patent Citations

  • Data acquisition method and device, electronic equipment and storage medium

    CN113691609A

  • Wireless connection method and electronic equipment

    CN114363871A

  • KR20220033337A