Linux Bluetooth Obex: Difference between revisions

From Variscite Wiki
(Initial version)
 
Line 2: Line 2:




= Sending Files using OBEX Protocol =
{{PageHeader|Bluetooth File Transfer}} {{DocImage|category1=Yocto|category2=VAR-SOM-MX6}}[[Category: DART-6UL]][[Category: VAR-SOM-MX7]] __toc__
 
= Pairing with Bluetooth device =
Before sending files bluetooth devices should be paired.
You can manage bluetooth with '''bluetoothctl''', type 'bluetoothctl' and enter the CLI. Type help to show commands.</br>
For pairing a device do the following:</br>
<pre>
$ bluetoothctl
[bluetooth]# power on
[bluetooth]# agent on
[bluetooth]# default-agent
[bluetooth]# pairable on
[bluetooth]# scan on
 
Copy mac address
 
[bluetooth]# scan off
[bluetooth]# pair <mac address>
 
Approve pairing on Device if required
 
[bluetooth]# trust <mac address>
[bluetooth]# quit
</pre>
 
= Sending files using OBEX Protocol =


To send a file to a paired device use '''obexctl''' tool.
To send a file to a paired device use '''obexctl''' tool.
Line 25: Line 50:
[DEL] Transfer /org/bluez/obex/client/session0/transfer0  
[DEL] Transfer /org/bluez/obex/client/session0/transfer0  
</pre>
</pre>
= Receiving files using OBEX Protocol =
No special action is required to receive a file that was sent from a paired device. The file will be stored under /tmp/bluetooth-inbox.

Revision as of 15:29, 9 February 2017

Bluetooth


Bluetooth File Transfer

Pairing with Bluetooth device

Before sending files bluetooth devices should be paired. You can manage bluetooth with bluetoothctl, type 'bluetoothctl' and enter the CLI. Type help to show commands.
For pairing a device do the following:

$ bluetoothctl
[bluetooth]# power on
[bluetooth]# agent on
[bluetooth]# default-agent
[bluetooth]# pairable on
[bluetooth]# scan on

Copy mac address

[bluetooth]# scan off
[bluetooth]# pair <mac address>

Approve pairing on Device if required

[bluetooth]# trust <mac address>
[bluetooth]# quit

Sending files using OBEX Protocol

To send a file to a paired device use obexctl tool.

root@imx6ul-var-dart:~# obexctl 
[NEW] Client /org/bluez/obex 
[obex]# connect 00:1A:7D:DA:71:0B
Attempting to connect to 00:1A:7D:DA:71:0B
[NEW] Session /org/bluez/obex/client/session0 [default]
[NEW] ObjectPush /org/bluez/obex/client/session0 
Connection successful
[00:1A:7D:DA:71:0B]# send /etc/fstab
Attempting to send /etc/fstab to /org/bluez/obex/client/session0
[NEW] Transfer /org/bluez/obex/client/session0/transfer0 
Transfer /org/bluez/obex/client/session0/transfer0
        Status: queued
        Name: fstab
        Size: 637
        Filename: /etc/fstab
        Session: /org/bluez/obex/client/session0
[CHG] Transfer /org/bluez/obex/client/session0/transfer0 Status: complete
[DEL] Transfer /org/bluez/obex/client/session0/transfer0 

Receiving files using OBEX Protocol

No special action is required to receive a file that was sent from a paired device. The file will be stored under /tmp/bluetooth-inbox.