Skip to main content

Send a file in the client role

Before you begin, set up the device as described in Set up the device for Bluetooth OPP functions. To send a file in the client role, do the following:
  1. Connect to the remote device by running the following command from the obexctl menu:
    connect <bt_address> <profile_name>
    
    Parameters
    • <bt_address> is the Bluetooth address of the remote device.
    • <profile_name> is opp.
    Example To connect to a remote device with <bt_address> 22:22:5A:A5:56:6B, run the following command:
    connect 22:22:5A:A5:56:6B opp
    
    Sample output
    [obex]# connect 22:22:5A:A5:56:6B opp
    Attempting to connect to 22:22:5A:A5:56:6B
    [NEW] Session /org/bluez/obex/client/session1 [default]
    [NEW] ObjectPush /org/bluez/obex/client/session1
    Connection successful
    [22:22:5A:A5:56:6B]#
    
  2. Create a text file at a local directory of the DUT.
  3. Send this text file to the remote device by running the following command from the obexctl menu:
    send <filepath>
    
    Parameters <filepath> is the filepath of the text file. Example To send a text file temp.txt at /local/mnt/workspace/, run the following command:
    send /local/mnt/workspace/temp.txt
    
    Sample output
    [22:22:5A:A5:56:6B]# send /local/mnt/workspace/temp.txt
    Attempting to send /local/mnt/workspace/temp.txt to /org/bluez/obex/client/session1
    [NEW] Transfer /org/bluez/obex/client/session1/transfer1
    Transfer /org/bluez/obex/client/session1/transfer1
       Status: queued
       Name: temp.txt
       Size: 36
       Filename: /local/mnt/workspace/temp.txt
       Session: /org/bluez/obex/client/session1
    [CHG] Transfer /org/bluez/obex/client/session1/transfer1 Status: complete
    [DEL] Transfer /org/bluez/obex/client/session1/transfer1
    [22:22:5A:A5:56:6B]#
    
  4. On the remote device, accept the prompt to receive the file. The file is successfully sent to the remote device.