# Perform Bluetooth SPP client functions

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

You can perform SPP client functions using the `spp_client_menu`
        options.

## About this task

Before you begin, set up the device and go to the SPP client menu as described in
                    Set up device for Bluetooth SPP functions.

**Parent Topic:** Serial Port Profile

## Configure DUT in SPP client role

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

### About this task

To configure the DUT in an SPP client role, do the following:

### Procedure

1. Run the SPP server in the remote device SPP application.
2. Initiate an SPP profile connection from DUT by running the following
                        command:
                    
connect <bt_addr>Copy to clipboard

**Parameters**

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

Run Bluetooth inquiry scan to get the
                            `<bt_addr>`.
3. Verify the output on the DUT for successful SPP connection.
                    
**Sample output**

The following sample output shows that the SPP connection has been
                            established successfully:

spp_client_menu
        
        ***************** Menu *******************
                 connect <bt_addr>
                 disconnect
                 send_file<space><directory_with_file_name>eg: send_file /var/fileName.txt
                 recv_file<space><directory_with_file_name>eg: recv_file /var/fileName.txt
                 send_data<space><with_size>eg: send_data 1000[Note:1000 means 1MB]
                 recv_data
                 main_menu
         ******************************************
        connect 22:22:85:3d:2e:50
        Connecting Device ... Please wait ...!!!
         ACL state:0 change with reason 00 for device: 22:22:85:3d:2e:50
        Device is Connected
        -----------------------
        Device Address       : 22:22:85:3d:2e:50
        Connection Direction : Client
        Copy to clipboard

Note: If you face any permission issues in the
                                `/var` directory, use the
                                `/etc/bluetooth` directory to send or receive files.

## Send a file in the client role

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

### About this task

To send a file in the client role, do the following:

### Procedure

1. Set the remote device in Receive mode in the SPP application, if
                        applicable.
2. Create a test file with some sample data and place the file in the
                            /etc/bluetooth directory of the DUT.
                    
For example, create a test file bt\_stack.conf.
3. Send the test file to the remote device by running the following
                        command:
                    
send_file <directory_with_file_name>Copy to clipboard

**Parameters**

`<directory_with_file_name>` is the complete file path
                            along with the filename.

**Example**

To send the test file bt\_stack.conf at
                                /etc/bluetooth, run the following command:

        send_file /etc/bluetooth/bt_stack.confCopy to clipboard

**Sample output**

send_file /etc/bluetooth/bt_stack.conf
        File Transfer Complete
        ---------------------
        Device Address : 22:22:85:3d:2e:50
        File Name      : /etc/bluetooth/bt_stack.confCopy to clipboard

Note: If an issue occurs, disconnect from the device
                            and resume the process.
4. Verify the status of the file reception on the remote application.

## Receive a file in client role

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

### About this task

To receive a file in the client role, do the following:

### Procedure

1. Set the DUT in Receive mode.
2. Receive a file from the remote device by running the following
                        command:
                    
recv_file <directory_with_file_name>Copy to clipboard

**Parameters**

`<directory_with_file_name>` is the complete file path
                            along with the filename.

Note: To receive a file,
                            use the /etc/bluetooth directory only.

**Example**

To receive fileName.txt at
                                /etc/bluetooth from the remote device, run the
                            following command:

        recv_file /etc/bluetooth/fileName.txtCopy to clipboard
3. Send the file from the remote device SPP server application.
4. Verify the received file as follows:
    1. Open the command prompt window.
    2. Pull the received file by running the following command:
                            
scp -r root@<IP_address>:<source_file_path> <destination_file_path>Copy to clipboard

To pull a file to the current file path, enter the
                                        `<destination_file_path>` as
                                        `.` in the command. 
Note: When
                                        prompted for a password, enter `oelinux123`
                                        to authenticate the file transfer via the Secure Copy
                                        Protocol (SCP).

**Example**

The IP address of the device is `10.92.160.222`.
                                    To pull fileName.txt from
                                        /etc/bluetooth, run the following
                                    command:

            scp -r root@10.92.160.222:/etc/bluetooth/fileName.txt .Copy to clipboard
    3. Open the received file and verify the data.
5. Disconnect the SPP connection from the DUT by running the following
                        command:
                    
disconnectCopy to clipboard

Last Published: Dec 26, 2024

Previous Topic
 
Perform Bluetooth SPP server functions Next Topic

General Attribute Profile