Skip to content

OBEX Profiles

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

OBEX (Object Exchange) is a protocol for transferring objects over Bluetooth. Four profiles build on OBEX for specific use cases.

OBEX is a binary protocol originally designed for infrared (IrDA) that was adapted for Bluetooth. It provides:

  • Session-based connections
  • Request/response pattern
  • Headers for metadata (name, type, length)
  • Support for large object transfers

Think of it as “HTTP for Bluetooth” — a simple way to push and pull objects between devices.

┌──────────────────────────────────────────────────────────────┐
│ OBEX Protocol │
├──────────────────────────────────────────────────────────────┤
│ OPP │ FTP │ PBAP │ MAP │
│ (Push) │ (Files) │ (Contacts) │ (Messages) │
└──────────────────────────────────────────────────────────────┘

Purpose: Simple file sending, like handing someone a file.

  • No session management needed
  • One-shot transfers
  • Receiver can accept or reject
  • Minimal device interaction required
OperationDescription
PushSend a file to device
PullGet device’s business card
  • Send a photo to a friend
  • Share a document
  • Exchange contact cards
bt_obex_send_file address="..." file_path="~/photo.jpg"
bt_obex_get_vcard address="..." save_path="~/contact.vcf"

Almost universal — OPP is the most widely supported OBEX profile.

DeviceSupport
Android
iPhone
Feature phones
Windows
macOS

Purpose: Browse and manage remote file systems.

  • Session-based (connect → browse → disconnect)
  • Full file system operations
  • Folder navigation
  • Two-way transfers
OperationDescription
ConnectCreate FTP session
ListGet folder contents
GetDownload file
PutUpload file
DeleteRemove file/folder
MkdirCreate folder
SetpathNavigate folders
  • Backup phone photos
  • Browse device storage
  • Manage files on remote device
bt_obex_connect address="..." target="ftp"
bt_obex_browse session_id="ftp_..."
bt_obex_get session_id="..." remote_path="photo.jpg" local_path="~/photo.jpg"
bt_obex_put session_id="..." local_path="~/doc.pdf" remote_path="doc.pdf"
bt_obex_disconnect session_id="ftp_..."

More limited than OPP:

DeviceSupport
AndroidVaries by version/manufacturer
iPhone
Feature phones✓ Usually
Windows
macOS

Purpose: Read contacts from a phone.

  • Read-only access (mostly)
  • Standardized folder structure
  • vCard format output
  • Search capabilities
telecom/
├── pb/ ← Main phonebook
├── ich/ ← Incoming call history
├── och/ ← Outgoing call history
├── mch/ ← Missed call history
└── cch/ ← Combined call history
SIM1/
└── telecom/
└── pb/ ← SIM card contacts
OperationDescription
PullAllDownload entire phonebook
ListGet contact handles
PullGet specific contact
SearchFind contacts by field
  • Sync contacts to car system
  • Backup phone contacts
  • Contact management applications
bt_phonebook_pull address="..." save_path="~/contacts.vcf"
bt_phonebook_list address="..." folder="telecom/pb"
bt_phonebook_search address="..." field="name" value="Smith"
bt_phonebook_count address="..."
DeviceSupport
Android✓ Full
iPhone✓ (when properly paired)
Feature phones✓ Usually
Car systems✓ Often

Purpose: Access SMS/MMS messages.

  • Read messages from phone
  • Some devices support sending
  • Folder-based organization
  • Notification of new messages
telecom/
└── msg/
├── inbox/
├── outbox/
├── sent/
├── drafts/
└── deleted/
OperationDescription
GetFolderListingList message folders
GetMessagesListingList messages in folder
GetMessageDownload message content
PushMessageSend message (if supported)
SetMessageStatusMark read/unread
  • Read texts through car system
  • Message backup
  • SMS integration applications
bt_messages_folders address="..."
bt_messages_list address="..." folder="inbox" unread_only=true
bt_messages_get address="..." handle="msg001" save_path="~/message.txt"
bt_messages_send address="..." recipient="+1555..." message="Hello"

Most limited of the OBEX profiles:

DeviceReadSend
AndroidVaries
iPhone
Car systems✓ (receive)
Client Server
│ │
│────── CONNECT ─────────→│
│←───── SUCCESS ──────────│
│────── PUT file ────────→│
│←───── SUCCESS ──────────│
│────── DISCONNECT ──────→│
│ │

OPP creates temporary sessions for each transfer.

Client Server
│ │
│────── CONNECT ─────────→│ ← Session created
│←───── SUCCESS ──────────│
│ │
│────── LIST ────────────→│
│←───── folder contents ──│
│ │
│────── GET file ────────→│
│←───── file data ────────│
│ │
│────── DISCONNECT ──────→│ ← Session closed
│ │

Sessions persist for multiple operations.

mcbluetooth uses BlueZ’s obexd daemon:

┌─────────────────────────────────────────────────────┐
│ mcbluetooth │
│ │ │
│ D-Bus (session) │
│ │ │
└────────────────────────┼────────────────────────────┘
┌─────────────────────────────────────────────────────┐
│ obexd │
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
│ │ OPP │ │ FTP │ │ PBAP │ │ MAP │ │
│ └─────────┘ └─────────┘ └─────────┘ └─────────┘ │
│ │ │
│ RFCOMM/L2CAP │
└────────────────────────┼────────────────────────────┘
Bluetooth Stack

obexd runs on the session D-Bus (not system bus), which means:

  • Requires active desktop session
  • Per-user isolation
  • Integrates with user’s file permissions

OBEX transfers report progress via D-Bus properties:

{
"Status": "active",
"Transferred": 52428800,
"Size": 104857600,
"Filename": "large_file.mp4"
}

mcbluetooth polls these properties to provide progress updates.

Common OBEX errors:

ErrorMeaning
NotSupportedProfile not available on device
NotAuthorizedPermission denied
NotFoundFile/folder doesn’t exist
ForbiddenOperation not allowed
FailedGeneric failure
  • OBEX uses Bluetooth encryption (if paired)
  • Phone typically prompts for permission on first access
  • Permission can be revoked in phone settings
  • Sessions are tied to pairing relationship