# Perform Bluetooth SPP server functions

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

You can perform SPP server functions using the `spp_server_menu`
        options.

## About this task

Before you begin, set up the device and go to the SPP server menu as described in
                    [Set up device for Bluetooth SPP functions](https://docs.qualcomm.com/doc/80-70017-13/topic/set_up_bluetooth_in_spp.html#set_up_bluetooth_in_spp__context_bgp_lts_s1c).

**Parent Topic:** [Serial Port Profile](https://docs.qualcomm.com/doc/80-70017-13/topic/set_up_bluetooth_in_spp.html)

## Configure DUT in SPP server role

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

### About this task

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

### Procedure

1. Start the server connection by running the following command:
                    
start_serverCopy to clipboard
2. Initiate a connection from the remote device SPP client application.
                    
**Sample output**

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

start server
         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 : ServerCopy to clipboard

## Send a file in the server role

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

### About this task

To send a file in the server 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
                            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 the operation
                            from the SPP client application on the remote device, and stop the SPP
                            server in the DUT by running the following command:

        stop_serverCopy to clipboard
4. Verify the status of file reception on the remote application.

## Receive a file in server role

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

### About this task

To receive a file in the server 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
                            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 operation from the remote device SPP client application, and
                        stop the SPP server in DUT by running the following command:
                    
stop_serverCopy to clipboard

Note: All devices of a particular development kit have
                            the same default MAC address.

Last Published: Dec 26, 2024

[Previous Topic
Serial Port Profile](https://docs.qualcomm.com/bundle/publicresource/80-70017-13/topics/set_up_bluetooth_in_spp.md) [Next Topic
Perform Bluetooth SPP client functions](https://docs.qualcomm.com/bundle/publicresource/80-70017-13/topics/perform_bluetooth_functions_in_spp_client.md)