# General Attribute Profile

Source: [https://docs.qualcomm.com/doc/80-70017-13/topic/set_up_ble_gatt.html](https://docs.qualcomm.com/doc/80-70017-13/topic/set_up_ble_gatt.html)

GATT is a service framework that uses the ATT to discover services, and to read and
        write characteristic values on a peer device.

To perform Bluetooth Low Energy GATT server or client functions, you must first
                complete the steps in the following procedure.

## Set up device for Bluetooth Low Energy GATT functions

**Prerequisites**

- Enable SSH to access your host device. For instructions, see [Log in using SSH](https://docs.qualcomm.com/bundle/publicresource/topics/80-70017-254/how_to.html#use-ssh).
- Place the DUT and the remote device in the Bluetooth vicinity.

**Procedure**

1. Run the SSH in command prompt using the following command: 

        ssh root@<device_IP_address>Copy to clipboard

    **Example**

If the IP address of the device is `10.92.160.222`, run
                            the following command:

        ssh root@10.92.160.222Copy to clipboard
2. Connect to the SSH by entering the following password: 

        oelinux123Copy to clipboard
3. Open the Bluetooth test application by running the following command: 

        btappCopy to clipboard

    **Sample output**

sh-5.1# btapp
         get_ap_interface
        :: get_ap_interface
        
        ***************** Menu *******************
                 gap_menu
                 test_menu
                 a2dp_sink_menu
                 hfp_client_menu
                 gattctest_menu
                 gattstest_menu
                 hogp_menu
                 hfp_ag_menu
                 a2dp_source_menu
                 spp_client_menu
                 spp_server_menu
                 eslap_menu
                 exit
         ******************************************Copy to clipboard
4. Enable Bluetooth as follows:
    1. Go to the Gap Menu by running the following
                            command: 

            gap_menuCopy to clipboard
    2. Enable Bluetooth by running the following command: 

            enableCopy to clipboard

        **Sample output**

gap_menu
            
            ***************** Menu *******************
                     enable
                     disable
                     inquiry
                     cancel_inquiry
                     get_role_req<space><bt_address>     eg. get_role_req 00:11:22:33:44:55
                     pair<space><bt_address><space><transport>     eg. pair 00:11:22:33:44:55 0(auto)/1(BREDR)/2(BLE)
                     unpair<space><bt_address>     eg. unpair 00:11:22:33:44:55
                     inquiry_list
                     bonded_list
                     get_state
                     get_bt_name
                     get_bt_address
                     set_bt_name<space><bt name>     eg. set_bt_name MDM_Fluoride
                     set_scan_mode<space><scan mode value (range 0-2)>     eg. set_scan_mode 0 --0-BT_SCAN_MODE_NONE,1- BT_SCAN_MODE_CONNECTABLE,2-BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE
                     set_afh<space><AFH_Host_Channel_Classification>     eg. set_afh 112233445566778899f0
                     send_hci_cmd<space><hci_cmd>     eg. send_hci_cmd 01,04,05,33,8b,9e,0a,00 - For Inquiry
                     read_clock<space><which_clock range(0-1)><space><bt_address>     eg. read_clock 0(local)/1(acl connection) 00:11:22:33:44:55
                     main_menu
                     switch_role_req<bt_address><space><new_role>     eg. switch_role_req 00:11:22:33:44:55 0 or get_role_req 00:11:22:33:44:55 1
             ******************************************
            enable
             current State = 0, new state = 1
             BT State is ONCopy to clipboard
    3. Return to the Main Menu by running the following
                            command: 

            main_menuCopy to clipboard
5. Go to the GATT server or client menu, as required.
    - To go to the GATT server menu, run the following command:

            gattstest_menuCopy to clipboard

        **Sample output**

main_menu
            ***************** Menu *******************
                     gap_menu
                     test_menu
                     a2dp_sink_menu
                     hfp_client_menu
                     gattctest_menu
                     gattstest_menu
                     hogp_menu
                     hfp_ag_menu
                     a2dp_source_menu
                     spp_client_menu
                     spp_server_menu
                     eslap_menu
                     exit
             ******************************************
            gattstest_menu
            
            ***************** Menu *******************
                     gattstest_init_server (only for Init time)
                     gattstest_addservers
                     gattstest_addservices<space><server instance><space><service instance>
                     gattstest_init_advertiser initialzes advertiser
                     gattstest_start_advertiser<space><server instance>
                     gattstest_readphy<space><remote address><server instance>
                     gattstest_set_preferred_phy<space><remote address><space><server instance><space><tx phy><space><rx phy><space><phy opt>
                     gattstest_stop<space><server_instance>
                     gattstest_disable
                     gattstest_cancel_connection<space><remote address>
                     gattstest_unregister_server<space><server instance>
                     main_menu
             ******************************************Copy to clipboard

        For GATT server functions, see [Perform Bluetooth Low Energy GATT server functions](https://docs.qualcomm.com/doc/80-70017-13/topic/perform_ble_gatt_server_functions.html).
    - To go to the GATT client menu, run the following command:

            gattctest_menuCopy to clipboard

        **Sample output**

main_menu
            
            ***************** Menu *******************
                     gap_menu
                     test_menu
                     a2dp_sink_menu
                     hfp_client_menu
                     gattctest_menu
                     gattstest_menu
                     hogp_menu
                     hfp_ag_menu
                     a2dp_source_menu
                     spp_client_menu
                     spp_server_menu
                     eslap_menu
                     exit
             ******************************************
            gattctest_menu
            
            ***************** Menu *******************
                     gattctest_init (only for Init time)
                     gattctest_scanset<space><scan_type><space><value>         eg: scanType: 0-NO_SET,1-SCAN_MODE,2-CB_Type,3-RESULT_TYPE,4-PHY,5-LEGACY,6-REPORT_DELAY,7-NUM_RESPONSE
                     gattctest_scanFilter<space><filter_type><space><filter_Value>         eg: filterType: 0-NO_FILT,1-FILT_BD_ADDR,2-FILT_DEV_NAME,3-FILT_SRVC_UUID
                     gattctest_scanFilter_manData<space><manuId><space><ManuData><space><ManuMask>
                     gattctest_start_scan
                     gattctest_stop_scan
                     gattctest_batch_scan  0-FULL MODE 1- TRUNCATED MODE
                     main_menu
                     gattctest_conn_params<space><isAuto><space><phy><space><isOppur>         eg: isAuto(0/1);phy (0-255 (0 bit:1M(1); 1bit:2M(2); 2bit:Coded(4); or any combination); isOppur(0/1))
                     gattctest_connect<space><bt_address><space><transport>         eg. gattctest_connect 00:11:22:33:44:55 0(Auto)/1(BREDR)/2(LE)
                     gattctest_disconnect<space><bt_address>           eg.gattctest_connect 00:11:22:33:44:55
                     gattctest_discsrvc<space><bdaddr>  discovering services
                     gattctest_rdchar_uuid<space><bdaddr><space><uuid>         eg: reading char by uuid
                     gattctest_readPhy<space><bt_address>
                     gattctest_readrssi<space><bt_address>
                     gattctest_reqMtu<space><bt_address><space><value>
                     gattctest_refresh<space><bt_address>
                     gattctest_setphy<space>          <TxValue(0-255,(0 bit:1M(1); 1bit:2M(2); 2bit:Coded(4); or any combination))><space><RxValue(0-255)><space><PhyOpt(0:no pref,1:s2,2:s8)><space><bt_address>
                     gattctest_getservices<space><bt_address>
                     gattctest_reqconn_pri<space><bt_address><space><priority 0/1/2>
                     gattctest_getcharid<space><bt_address><space><instanceid>
                     gattctest_reliablewrite<space><bt_address><space><instanceid>
                     gattctest_getdescid<space><bt_address><space><instanceid>
                     gattctest_getsrvc<space><bt_address><space><UUID><space><INSTANCEID>
                     gattctest_RdWrDesc<space><bt_address><space><R-2/W-1><space><value><space><INSTANCEID><space><value length>
                     gattctest_RdWrchar<space><bt_address><space><R-2/W-1><space><value><space><INSTANCEID><space><value length>
                     gattctest_conn_dev
                     gattctest_register_notifications<space><bt_address><space><CHARINSTANCEID><space><DESCINSTANCEID><space><E-1/D-0>
             ******************************************Copy to clipboard

        For GATT client functions, see [Perform Bluetooth Low Energy GATT client functions](https://docs.qualcomm.com/doc/80-70017-13/topic/perform_ble_gatt_client_functions.html).

- **[Perform Bluetooth Low Energy GATT server functions](https://docs.qualcomm.com/doc/80-70017-13/topic/perform_ble_gatt_server_functions.html)**  

You can perform Bluetooth Low Energy GATT server functions using the             `gattstest_menu` options.
- **[Perform Bluetooth Low Energy GATT client functions](https://docs.qualcomm.com/doc/80-70017-13/topic/perform_ble_gatt_client_functions.html)**  

You can perform Bluetooth Low Energy GATT client functions using the             `gattctest_menu` options.
- **[GATT configuration parameters](https://docs.qualcomm.com/doc/80-70017-13/topic/gatt_config_params.html)**  

To configure the GATT server and client functions, use the server, client, and scan         parameters.

**Parent Topic:** [Verify functionality of Fluoride stack](https://docs.qualcomm.com/doc/80-70017-13/topic/bluetooth_usecases.html)

Last Published: Dec 26, 2024

[Previous Topic
Perform Bluetooth SPP client functions](https://docs.qualcomm.com/bundle/publicresource/80-70017-13/topics/perform_bluetooth_functions_in_spp_client.md) [Next Topic
Perform Bluetooth Low Energy GATT server functions](https://docs.qualcomm.com/bundle/publicresource/80-70017-13/topics/perform_ble_gatt_server_functions.md)