A Generic Attribute (GATT) profile establishes in detail how to exchange all profile and user data over a Bluetooth low energy (BLE) connection. GATT profile defines two roles named as a server and a client, wherein the server is a device which stores attribute data locally, and the client is a device which accesses data on the server. In the communication between the server and the client, because the client does not know anything in advance about the server’s attributes, the client must inquire about the presence and nature of those attributes by performing a service discovery. After completing the service discovery, the client can start accessing the server.
Nowadays, many multipoint Bluetooth devices such as a pair of earphones or a group of speakers are released. If the client needs to use the services of these multipoint Bluetooth devices, the client needs to perform the service discovery to each of the devices. Therefore, since the client needs to perform two or more service discovery steps before using the service, it will lead to a long waiting time and also increase the power consumption of the client.
It is therefore an objective of the present invention to provide a GATT service discovery method, which can perform the service discovery to only one server before using the service of at least two serves, to solve the above-mentioned problems.
According to one embodiment of the present invention, a control method of an electronic device comprises the steps of: wirelessly connecting to a first device; performing a service discovery to the first device to retrieve a plurality of attribute handles from the first device; storing the plurality of attribute handles of the first device into a database cache; wirelessly connecting to a second device; determining whether the second device and the first device have the same attribute handles; and in response to the second device having the same attribute handles as the first device, directly using the plurality of attribute handles of the first device stored in the database cache, for using services of the second device.
According to one embodiment of the present invention, a circuitry of an electronic device is configured to perform the steps of: wirelessly connecting to a first device; performing a service discovery to the first device to retrieve a plurality of attribute handles from the first device; storing the plurality of attribute handles of the first device into a database cache; wirelessly connecting to a second device; determining whether the second device and the first device have the same attribute handles; and in response to the second device having the same attribute handles as the first device, directly using the plurality of attribute handles of the first device stored in the database cache, for using services of the second device.
According to one embodiment of the present invention, an electronic device comprising a wireless network module and a storage device is disclosed. The wireless network module wirelessly connects to a first device, performs a service discovery to the first device to retrieve a plurality of attribute handles from the first device, and stores the plurality of attribute handles of the first device into the storage device; and the wireless network module wirelessly connects to a second device, and determines whether the second device and the first device have the same attribute handles; and in response to the second device having the same attribute handles as the first device, the wireless network module directly uses the plurality of attribute handles of the first device stored in the storage device, for using services of the second device.
These and other objectives of the present invention will no doubt become obvious to those of ordinary skill in the art after reading the following detailed description of the preferred embodiment that is illustrated in the various figures and drawings.
Certain terms are used throughout the following description and claims to refer to particular system components. As one skilled in the art will appreciate, manufacturers may refer to a component by different names. This document does not intend to distinguish between components that differ in name but not function. In the following discussion and in the claims, the terms “including” and “comprising” are used in an open-ended fashion, and thus should be interpreted to mean “including, but not limited to ...”. The terms “couple” and “couples” are intended to mean either an indirect or a direct electrical connection. Thus, if a first device couples to a second device, that connection may be through a direct electrical connection, or through an indirect electrical connection via other devices and connections.
In this embodiment, the wireless network module 120 is a Bluetooth module that complies with BLE specification, and the electronic device 100 is able to use the wireless network module 120 to communicate to a first device 102_1 and a second device 102_2 shown in
The attributes are only in the GATT server, and the GATT client needs the attributes of the GATT server to have the service, so the GATT client needs to perform the service discovery to obtain all the attribute handles of the GATT server and stores the attribute handles into a database cache of the storage device 130. Then, after the service discovery is completed, the GATT client can start using the service of the GATT server, for example, sending an audio signal to the GATT server for playback, or sending a control signal to the GATT server to control its volume. In this embodiment, because the electronic device 100 needs services of the pair of earphones (i.e. the first device 102_1 and the second device 102_2), if it is determined that the first device 102_1 and the second device 102_2 have the same GATT services (i.e. all the attribute handles are the same in device 102_1 and device 102_2), the electronic device 100 can perform the service discovery to the first device 102_1 only to retrieve the attribute handles and stores the retrieved attribute handles into the database cache, then the electronic device 100 directly uses the attribute handles stored in the database cache, without performing the service discovery to the second device 102_2, for using the services of both the first device 102_1 and the second device 102_2. By using the above mechanism, latency of the electronic device 100 can be improved.
It is noted that a number of GATT servers in the present invention is not limited to two. In other embodiments, the electronic device 100 may connect to three or more GATT servers such as many speakers or several pairs of earphones. In one embodiment, after the Step 412 or the Step 416 is completely executed, if a third device is connected to the electronic device 100, the wireless network module 120 can determine whether the third device has the same GATT services structure as the first device 102_1 and/or the second device 102_2; and if the third device has the same GATT services structure as the first device 102_1 and/or the second device 102_2, the wireless network module 120 can directly use the attribute handles of the first device 102_1 or the attribute handles of the second device 102_2 stored in the database cache, without performing the service discovery to the third device, for using the service of the third device.
Briefly summarized, in the present invention, when the GATT client needs to use the service of two or more GATT servers having the same GATT services structure, the GATT client may perform the service discovery to only one GATT server to obtain attribute handles, and directly use the attribute handles to use services of two or more GATT servers. By using the control method of the present invention, the GATT client can preserve time and power for not doing other service discovery procedures.
Those skilled in the art will readily observe that numerous modifications and alterations of the device and method may be made while retaining the teachings of the invention. Accordingly, the above disclosure should be construed as limited only by the metes and bounds of the appended claims.
This application claims the benefit of U.S. Provisional Application No. 63/297,248, filed on January 7th, 2022. The content of the application is incorporated herein by reference.
| Number | Date | Country | |
|---|---|---|---|
| 63297248 | Jan 2022 | US |