# Perform Bluetooth Low Energy GATT server functions

You can perform Bluetooth Low Energy GATT server functions using the **GATT submenu** options and `bluetoothctl` commands.

## Prerequisites

Before you begin, set up the device as described in [Set up the device for Bluetooth Low Energy GATT functions](https://docs.qualcomm.com/doc/80-70022-13/topic/bluez-gatt.html#section-ajz-mss-lcc-navyanka-08-21-24-1419-1-422).

## Connect to a remote device

To connect to a remote device, run the following command from the `bluetoothctl` menu:

connect <bt_address>
    Copy to clipboard

**Parameters**

`<bt_address>` is the Bluetooth address of the remote device.

Note

To get the Bluetooth address of the remote device, run a [Bluetooth Low Energy GATT scan](https://docs.qualcomm.com/doc/80-70022-13/topic/bluez-perform-bluetooth-low-energy-gatt-client-functions.html#section-oyf-kts-lcc-navyanka-08-21-24-1425-50-130).

**Example**

To connect to a client with `<bt_address>` `6D:38:AF:C6:B5:62`, run the following command:

connect 6D:38:AF:C6:B5:62
    Copy to clipboard

## Add a primary service

To add a primary service to the GATT server, run the following command from the `menu gatt` menu:

register-service <UUID> [handle]
    Copy to clipboard

**Example**

If the UUID of the service is `FF01` and the handle is `30`, run the following command:

register-service FF01 30
    Copy to clipboard

**Sample output**

[MyDeviceB:/service0001/char0008]# register-service FF01 30
    [NEW] Primary Service (Handle 0x001e)
          /org/bluez/app/service0
          FF01
    [/org/bluez/app/service0] Primary (yes/no): yes
    Copy to clipboard

## Add a characteristic

To add a characteristic to a service of the server, run the following command from the `menu gatt` menu:

register-characteristic <UUID> <Flags=read,write,notify...> [handle]
    Copy to clipboard

**Parameters**

`<Flags>` are the flag values of the characteristic. For values, see [Flag values](https://docs.qualcomm.com/doc/80-70022-13/topic/bluez-perform-bluetooth-low-energy-gatt-server-functions.html#section-oxp-rwr-mcc-navyanka-08-25-24-121-25-224).

**Example**

The UUID of a service is `FF02`, the flags are `read,write,notify`, and the handle is `31`. To add a characteristic, run the following command:

register-characteristic FF02 read,write,notify 31
    Copy to clipboard

**Sample output**

[MyDeviceB]# register-characteristic FF02 read,write,notify 31
    [NEW] Characteristic (Handle 0x001f)
          /org/bluez/app/service0/chrc0
          FF02
    <egister-characteristic FF02 read,write,notify 31[/org/bluez/app/service0/chrc0] Enter value: 20
    Copy to clipboard

## Add a descriptor

To add a descriptor to a characteristic in the server, run the following command from the `menu gatt` menu:

register-descriptor <UUID> <Flags=read,write...> [handle]
    Copy to clipboard

**Parameters**

`<Flags>` are the flag values of the descriptor. For values, see [Flag values](https://docs.qualcomm.com/doc/80-70022-13/topic/bluez-perform-bluetooth-low-energy-gatt-server-functions.html#section-oxp-rwr-mcc-navyanka-08-25-24-121-25-224).

**Example**

The UUID of a service is `FF03`, the flags are `read,write`, and the handle is `33`. To add a descriptor, run the following command:

register-descriptor FF03 read,write 33
    Copy to clipboard

**Sample output**

[MyDeviceB]# register-descriptor FF03 read,write 33
    [NEW] Descriptor (Handle 0x0021)
       /org/bluez/app/service0/chrc0/desc0
       FF03
    <egister-descriptor FF03 read,write 33[/org/bluez/app/service0/chrc0/desc0] Enter value: 21
    Copy to clipboard

## Add an included service

Before you begin, add the intended services as [primary services](https://docs.qualcomm.com/doc/80-70022-13/topic/bluez-perform-bluetooth-low-energy-gatt-server-functions.html#section-nxh-kss-lcc-navyanka-08-21-24-1418-14-479).

To add an included service to another service, run the following command from the `menu gatt` menu:

register-includes <UUID> <UUID>
    Copy to clipboard

**Example**

Consider two primary services with the UUID `FF01` and `1112`, respectively. To add the service `1112` as an included service to the service `FF01`, run the following command:

register-includes FF01 1112
    Copy to clipboard

**Sample output**

[MyDeviceB]# register-includes FF01 1112
    [NEW] Primary Service (Handle 0x001e)
          /org/bluez/app/service0
          FF01
    [NEW] Primary Included Service (Handle 0x0000)
          /org/bluez/app/service1
          1112
          Unknown
    Copy to clipboard

## Register an application

To publish the services that are available or added to the server, run the following command from the `menu gatt` menu:

register-application [UUID]
    Copy to clipboard

**Example**

The UUID of the service is `FF01`. To publish the services that are available or added to the server, run the following command:

register-application FF01
    Copy to clipboard

**Sample output**

[MyDeviceB]# register-application FF01
    [CHG] Secondary Service (Handle 0x0015)
       /org/bluez/app/service2
       1112
       Unknown
    [CHG] Controller 22:22:9B:2C:79:1E UUIDs: 0000110e-0000-1000-8000-00805f9b34fb
    [CHG] Controller 22:22:9B:2C:79:1E UUIDs: 00001200-0000-1000-8000-00805f9b34fb
    [CHG] Controller 22:22:9B:2C:79:1E UUIDs: 0000111f-0000-1000-8000-00805f9b34fb
    [CHG] Controller 22:22:9B:2C:79:1E UUIDs: 0000110b-0000-1000-8000-00805f9b34fb
    [CHG] Controller 22:22:9B:2C:79:1E UUIDs: 00001108-0000-1000-8000-00805f9b34fb
    [CHG] Controller 22:22:9B:2C:79:1E UUIDs: 0000110c-0000-1000-8000-00805f9b34fb
    [CHG] Controller 22:22:9B:2C:79:1E UUIDs: 00001800-0000-1000-8000-00805f9b34fb
    [CHG] Controller 22:22:9B:2C:79:1E UUIDs: 0000110a-0000-1000-8000-00805f9b34fb
    [CHG] Controller 22:22:9B:2C:79:1E UUIDs: 00001801-0000-1000-8000-00805f9b34fb
    [CHG] Controller 22:22:9B:2C:79:1E UUIDs: 0000180a-0000-1000-8000-00805f9b34fb
    [CHG] Controller 22:22:9B:2C:79:1E UUIDs: 0000111e-0000-1000-8000-00805f9b34fb
    [CHG] Controller 22:22:9B:2C:79:1E UUIDs: 00001112-0000-1000-8000-00805f9b34fb
    [CHG] Primary Service (Handle 0x0016)
       /org/bluez/app/service1
       FF01
    [CHG] Controller 22:22:9B:2C:79:1E UUIDs: 0000110e-0000-1000-8000-00805f9b34fb
    [CHG] Controller 22:22:9B:2C:79:1E UUIDs: 00001200-0000-1000-8000-00805f9b34fb
    [CHG] Controller 22:22:9B:2C:79:1E UUIDs: 0000111f-0000-1000-8000-00805f9b34fb
    [CHG] Controller 22:22:9B:2C:79:1E UUIDs: 0000110b-0000-1000-8000-00805f9b34fb
    [CHG] Controller 22:22:9B:2C:79:1E UUIDs: 00001108-0000-1000-8000-00805f9b34fb
    [CHG] Controller 22:22:9B:2C:79:1E UUIDs: 0000110c-0000-1000-8000-00805f9b34fb
    [CHG] Controller 22:22:9B:2C:79:1E UUIDs: 00001800-0000-1000-8000-00805f9b34fb
    [CHG] Controller 22:22:9B:2C:79:1E UUIDs: 0000110a-0000-1000-8000-00805f9b34fb
    [CHG] Controller 22:22:9B:2C:79:1E UUIDs: 00001801-0000-1000-8000-00805f9b34fb
    [CHG] Controller 22:22:9B:2C:79:1E UUIDs: 0000180a-0000-1000-8000-00805f9b34fb
    [CHG] Controller 22:22:9B:2C:79:1E UUIDs: 0000ff01-0000-1000-8000-00805f9b34fb
    [CHG] Controller 22:22:9B:2C:79:1E UUIDs: 0000111e-0000-1000-8000-00805f9b34fb
    [CHG] Controller 22:22:9B:2C:79:1E UUIDs: 00001112-0000-1000-8000-00805f9b34fb
    Application registered
    [CHG] Controller 22:22:9B:2C:79:1E UUIDs: 0000110e-0000-1000-8000-00805f9b34fb
    [CHG] Controller 22:22:9B:2C:79:1E UUIDs: 00001200-0000-1000-8000-00805f9b34fb
    [CHG] Controller 22:22:9B:2C:79:1E UUIDs: 0000111f-0000-1000-8000-00805f9b34fb
    [CHG] Controller 22:22:9B:2C:79:1E UUIDs: 0000110b-0000-1000-8000-00805f9b34fb
    [CHG] Controller 22:22:9B:2C:79:1E UUIDs: 00001108-0000-1000-8000-00805f9b34fb
    [CHG] Controller 22:22:9B:2C:79:1E UUIDs: 0000110c-0000-1000-8000-00805f9b34fb
    [CHG] Controller 22:22:9B:2C:79:1E UUIDs: 00001800-0000-1000-8000-00805f9b34fb
    [CHG] Controller 22:22:9B:2C:79:1E UUIDs: 0000110a-0000-1000-8000-00805f9b34fb
    [CHG] Controller 22:22:9B:2C:79:1E UUIDs: 00001801-0000-1000-8000-00805f9b34fb
    [CHG] Controller 22:22:9B:2C:79:1E UUIDs: 0000180a-0000-1000-8000-00805f9b34fb
    [CHG] Controller 22:22:9B:2C:79:1E UUIDs: 0000ff01-0000-1000-8000-00805f9b34fb
    [CHG] Controller 22:22:9B:2C:79:1E UUIDs: 0000111e-0000-1000-8000-00805f9b34fb
    Copy to clipboard

## Start an advertisement

To start a GATT advertisement, run the following command from the `bluetoothctl` menu:

advertise on
    Copy to clipboard

**Sample output**

[MyDeviceB]# advertise on
    [CHG] Controller 22:22:9B:2C:79:1E SupportedInstances: 0x0f (15)
    [CHG] Controller 22:22:9B:2C:79:1E ActiveInstances: 0x01 (1)
    Advertising object registered
    Tx Power: off
    Name: off
    Appearance: off
    Discoverable: on
    Copy to clipboard

## Disconnect a remote device

To disconnect a remote device, run the following command from the `bluetoothctl` menu:

disconnect <bt_address>
    Copy to clipboard

**Parameters**

`<bt_address>` is the Bluetooth address of the remote device.

**Example**

To disconnect a client with `<bt_address>` `6D:38:AF:C6:B5:62`, run the following command:

disconnect 6D:38:AF:C6:B5:62
    Copy to clipboard

## Flag values

The value of `<Flags>` can be:

| `broadcast` | `authenticated-signed-writes` | `encrypt-authenticated-read` | `encrypt-authenticated-notify` |
| --- | --- | --- | --- |
| `read` | `extended-properties` | `encrypt-authenticated-write` | `secure-notify` |
| `write` | `reliable-write` | `secure-read` | `encrypt-indicate` |
| `write-without-response` | `writable-auxiliaries` | `secure-write` | `encrypt-authenticated-indicate` |
| `notify` | `encrypt-read` | `authorize` | `secure-indicate` |
| `indicate` | `encrypt-write` | `encrypt-notify` |  |

Last Published: Sep 15, 2025

[Previous Topic
Verify GATT functions](https://docs.qualcomm.com/bundle/publicresource/80-70022-13/topics/bluez-gatt.md) [Next Topic
Perform Bluetooth Low Energy GATT client functions](https://docs.qualcomm.com/bundle/publicresource/80-70022-13/topics/bluez-perform-bluetooth-low-energy-gatt-client-functions.md)