Skip to content

OBEX Tools

import { Aside } from ‘@astrojs/starlight/components’;

Tools for OBEX profiles — file transfer (OPP/FTP), phonebook access (PBAP), and message access (MAP).

Check OBEX subsystem status.

Parameters: None

Returns:

{
"status": "ready",
"obexd_installed": true,
"obexd_running": true,
"dbus_accessible": true,
"active_sessions": []
}

Example:

bt_obex_status

Start the obexd daemon if not running.

Parameters: None

Returns:

{
"status": "started",
"pid": 12345
}

Example:

bt_obex_start_daemon

Create an OBEX session to a device.

Parameters:

NameTypeRequiredDescription
addressstringYesDevice MAC address
targetstringYesProfile: “opp”, “ftp”, “pbap”, “map”

Returns:

{
"success": true,
"session_id": "ftp_AABBCCDDEEFF",
"address": "AA:BB:CC:DD:EE:FF",
"target": "ftp"
}

Example:

bt_obex_connect address="AA:BB:CC:DD:EE:FF" target="ftp"

Close an OBEX session.

Parameters:

NameTypeRequiredDescription
session_idstringYesSession ID from bt_obex_connect

Returns:

{
"status": "disconnected",
"session_id": "ftp_AABBCCDDEEFF"
}

Example:

bt_obex_disconnect session_id="ftp_AABBCCDDEEFF"

List active OBEX sessions.

Parameters: None

Returns:

{
"sessions": [
{
"session_id": "ftp_AABBCCDDEEFF",
"address": "AA:BB:CC:DD:EE:FF",
"target": "ftp",
"created": "2024-01-15T10:30:00"
}
]
}

Send a file via Object Push Profile.

Parameters:

NameTypeRequiredDefaultDescription
addressstringYes-Device MAC address
file_pathstringYes-Local file to send
waitbooleanNotrueWait for transfer completion

Returns:

{
"status": "complete",
"filename": "report.pdf",
"size": 102400,
"transferred": 102400
}

Or if wait=false:

{
"status": "started",
"transfer_path": "/org/bluez/obex/client/session0/transfer0"
}

Example:

bt_obex_send_file address="AA:BB:CC:DD:EE:FF" file_path="~/Documents/report.pdf"

Pull business card (vCard) from device.

Parameters:

NameTypeRequiredDescription
addressstringYesDevice MAC address
save_pathstringYesWhere to save the vCard

Returns:

{
"status": "complete",
"save_path": "/home/user/contact.vcf",
"size": 512
}

Example:

bt_obex_get_vcard address="AA:BB:CC:DD:EE:FF" save_path="~/contact.vcf"

List files and folders at a path.

Parameters:

NameTypeRequiredDefaultDescription
session_idstringYes-FTP session ID
pathstringNo”/“Path to list (”/” for root, ”..” to go up)

Returns:

{
"path": "/DCIM",
"entries": [
{"name": "Camera", "type": "folder"},
{"name": "photo.jpg", "type": "file", "size": 2048576}
]
}

Example:

bt_obex_browse session_id="ftp_..." path="/DCIM"

Download a file from the device.

Parameters:

NameTypeRequiredDescription
session_idstringYesFTP session ID
remote_pathstringYesFile path on device
local_pathstringYesWhere to save locally

Returns:

{
"status": "complete",
"remote_path": "photo.jpg",
"local_path": "/home/user/Downloads/photo.jpg",
"size": 2048576
}

Example:

bt_obex_get session_id="ftp_..." remote_path="photo.jpg" local_path="~/Downloads/photo.jpg"

Upload a file to the device.

Parameters:

NameTypeRequiredDescription
session_idstringYesFTP session ID
local_pathstringYesLocal file to upload
remote_pathstringYesDestination path on device

Returns:

{
"status": "complete",
"local_path": "/home/user/document.pdf",
"remote_path": "document.pdf",
"size": 102400
}

Example:

bt_obex_put session_id="ftp_..." local_path="~/document.pdf" remote_path="document.pdf"

Delete a file or folder on the device.

Parameters:

NameTypeRequiredDescription
session_idstringYesFTP session ID
remote_pathstringYesFile/folder to delete

Returns:

{
"status": "deleted",
"path": "old_file.txt"
}

Example:

bt_obex_delete session_id="ftp_..." remote_path="old_file.txt"

Create a folder on the device.

Parameters:

NameTypeRequiredDescription
session_idstringYesFTP session ID
folder_namestringYesName of folder to create

Returns:

{
"status": "created",
"folder": "Backup"
}

Example:

bt_obex_mkdir session_id="ftp_..." folder_name="Backup"

Check progress of a transfer.

Parameters:

NameTypeRequiredDescription
transfer_pathstringYesTransfer path from send/get operations

Returns:

{
"status": "active",
"filename": "large_file.mp4",
"size": 104857600,
"transferred": 52428800,
"progress_percent": 50
}

Example:

bt_obex_transfer_status transfer_path="/org/bluez/obex/client/session0/transfer0"

Cancel an in-progress transfer.

Parameters:

NameTypeRequiredDescription
transfer_pathstringYesTransfer path to cancel

Returns:

{
"status": "cancelled",
"transfer_path": "..."
}

Download entire phonebook as vCard file.

Parameters:

NameTypeRequiredDescription
addressstringYesDevice MAC address
save_pathstringYesWhere to save

Returns:

{
"status": "complete",
"save_path": "/home/user/contacts.vcf",
"count": 150
}

List phonebook entries with handles.

Parameters:

NameTypeRequiredDefaultDescription
addressstringYes-Device MAC address
folderstringNo”telecom/pb”Phonebook folder

Folders:

  • telecom/pb — Main phonebook
  • telecom/ich — Incoming call history
  • telecom/och — Outgoing call history
  • telecom/mch — Missed call history

Returns:

{
"entries": [
{"handle": "1.vcf", "name": "Alice Smith"},
{"handle": "2.vcf", "name": "Bob Jones"}
],
"count": 150
}

Download single contact by handle.

Parameters:

NameTypeRequiredDescription
addressstringYesDevice MAC address
handlestringYesContact handle from list
save_pathstringYesWhere to save vCard

Search phonebook by field.

Parameters:

NameTypeRequiredDescription
addressstringYesDevice MAC address
fieldstringYesField to search: “name”, “number”, “email”
valuestringYesSearch value

Get total number of contacts.

Parameters:

NameTypeRequiredDescription
addressstringYesDevice MAC address

Returns:

{
"count": 150
}

List message folders.

Parameters:

NameTypeRequiredDescription
addressstringYesDevice MAC address

Returns:

{
"folders": [
{"name": "inbox"},
{"name": "sent"},
{"name": "drafts"},
{"name": "outbox"},
{"name": "deleted"}
]
}

List messages in a folder.

Parameters:

NameTypeRequiredDefaultDescription
addressstringYes-Device MAC address
folderstringNo”inbox”Folder to list
unread_onlybooleanNofalseOnly unread messages
max_countintegerNo100Maximum messages to return

Returns:

{
"messages": [
{
"handle": "msg001",
"subject": "Meeting tomorrow",
"sender": "+15551234567",
"timestamp": "2024-01-15T10:30:00",
"read": false,
"type": "SMS"
}
]
}

Download message content.

Parameters:

NameTypeRequiredDescription
addressstringYesDevice MAC address
handlestringYesMessage handle from list
save_pathstringYesWhere to save message

Send a message via MAP.

Parameters:

NameTypeRequiredDescription
addressstringYesDevice MAC address
recipientstringYesPhone number to send to
messagestringYesMessage text