OBEX

Note: To see the OBEX protocol being used in an application example, see section Example: Creating an OBEX connection.

The OBEX protocol is a compact binary, session-layer protocol for exchanging complex data in a simple, efficient manner. Originally it was created for infrared connectivity and was used in the Infrared Data Association (IrDA) protocol stack. Bluetooth Special Interest Group (SIG) has defined the use of the OBEX protocol over Bluetooth connections in the IrDA Interoperability Specification.

The purpose of the protocol is to support sending and receiving objects in a simple and spontaneous manner. For example, pushing business cards or synchronizing calendars on multiple devices is handled with this protocol.

A major use of OBEX is a "Push" or "Pull" application. However, OBEX is not limited to quick connect-transfer-disconnect scenarios - it also allows sessions in which transfers take place over a period of time, maintaining the connection even when it is idle.

OBEX performs a function similar to HTTP; however, OBEX can work on devices that cannot afford the substantial resources required for an HTTP server. It also targets devices with different usage models from the Web. The OBEX protocol, in its simplest form, is quite compact and requires a small amount of code to implement. It can reside on top of any reliable transport.

The OBEX session protocol allows the higher layers of the stack to work with logical elements of a higher layer of abstraction than that of the packet formats used by the transport protocols, for example, RFCOMM. As the IrDA OBEX specification states, this is ensured by two major elements of the OBEX protocol:

The table below provides the exact definitions of OBEX terms.

Table 13: OBEX definitions. Source: IrDA OBEX specification

Term

Meaning

OBEX Client

An OBEX Client is the entity that initiates the underlying transport connection to an OBEX server and initiates OBEX operations.

OBEX Server

An OBEX Server is the entity that responds to OBEX operations. The OBEX server waits for the OBEX client to initiate the underlying transport connection.

OBEX Connection

An OBEX Connection is a virtual binding between two applications or services. An OBEX connection is initiated by sending an OBEX CONNECT packet. Once a connection is established, all operations sent over the connection are interpreted in a continuous context.

Application

An OBEX application communicates using a proprietary method known only by the manufacturer. Such applications can only expect to be understood by exact peers. Alternatively, an application may be a service with proprietary extensions. In this case the application must know if it is communicating with a service or application peer.