词条 | OBject EXchange | |||||||||||||||||||||||||||||||||||||||||
释义 |
OBEX (abbreviation of OBject EXchange, also termed IrOBEX) is a communications protocol that facilitates the exchange of binary objects between devices. It is maintained by the Infrared Data Association but has also been adopted by the Bluetooth Special Interest Group and the SyncML wing of the Open Mobile Alliance (OMA). One of OBEX's earliest popular applications was in the Palm III. This PDA and its many successors use OBEX to exchange business cards, data, even applications. Although OBEX was initially designed for infrared, it has now been adopted by Bluetooth, and is also used over RS-232, USB, WAP and in devices such as Livescribe smartpens. Comparison to HTTPOBEX is similar in design and function to HTTP in providing the client with a reliable transport for connecting to a server and may then request or provide objects. But OBEX differs in many important respects:
ObjectsOBEX works by exchanging objects, which are used for a variety of purposes: establishing the parameters of a connection, sending and requesting data, changing the current path or the attributes of a file. Objects are fields and headers. As an example, the following may be the object used for requesting the phonebook from a mobile:
This object contains two fields (command and length) and two headers. The first field (command) specifies that is a request for data (GET). The second field is the total size of the object, including the two fields. This object also contains two headers, specifically a "Connection ID" and a "Name". The first byte of each header is the header's name and its content type. In this case:
A possible response, containing the requested data, could be:
In this example, the phonebook is assumed short enough to be contained in a single response object. The only header has 0x49 as its identifier, meaning that it is an "End of Body", the last chunk of information (also the only one, in this case). The first two bits of 0x49 are 01, meaning that the content of this header is length-prefixed data: the two next bytes 0x00 0x2F tells the length of this data (in decimal, 47), the succeeding ones are the data, in this case a phonebook comprising only an empty vCard of 47 bytes. This example shows a single GET command and its response, the only headers involved being connection id, name and end-of-body. Before issuing it, a CONNECT command should have been sent for establishing some parameters of the connection, including the connection id. Other commands are: put, setpath, action, abort, disconnect. Some other notable headers include: type, time, description, target. SessionAfter the client (e.g., computer) connects to the server (e.g., mobile), a typical session consists in the client sending a number of objects and getting their responses from the server. As an example:
The exchange may differ significantly depending on the service. For example, SyncML does not use SETPATH, while a OBEX push is made of just CONNECT (without a TARGET header), PUT and an optional DISCONNECT. ProtocolsThe following protocols runs over OBEX, or have bindings to do so:
Transfers a file from the originator of the request to the recipient; a CONNECTION object containing no target is sent, then PUT is used to transfer the file
Stores and retrieves files, similar to FTP. The target header of the CONNECTION object is {0xF9, 0xEC, 0x7B, 0xC4, 0x95, 0x3C, 0x11, 0xD2, 0x98, 0x4E, 0x52, 0x54, 0x00, 0xDC, 0x9E, 0x09}; the response contains the connection id to use in subsequent GET, PUT, SETPATH and ACTION object.
Similar to file transfer, but uses a target {0x79, 0x61, 0x35, 0xF0, 0xF0, 0xC5, 0x11, 0xD8, 0x09, 0x66, 0x08, 0x00, 0x20, 0x0C, 0x9A, 0x66}; phonebook entries can be listed (with various possible orderings and filters) and retrieved from certain directories under telecom/ using GET and SETPATH
IrMC was designed for the exchange of phonebook entries, calendar entries, digital business cards, and to-do lists. In its connectionless form, a single PUT is used to transfer data; otherwise, various files and folders within telecom/ can be retrieved or pushed; a target header {'I', 'R', 'M', 'C', '-', 'S', 'Y', 'N', 'C'} may be used in GET requests to differentiate the kind of indexing used
SyncML can synchronize phonebooks, calendars, notes, and other data. In its OBEX binding, the target of the CONNECT object is {'S', 'Y', 'N', 'C', 'M', 'L', '-', 'S', 'Y', 'N', 'C'}; a session then consists in a sequence of PUT-GET pairs where nameless XML or WBXML files are sent and received, in turn. Implementationsjavax.obexOptional package javax.obex in Java APIs for Bluetooth provides an implementation of OBEX in Java.[1] OpenObexOpenObex is an open-source implementation of OBEX in C. It provides functions for connecting over IrDA, Bluetooth, USB and TCP/IP, building objects and handling received data. An example schema of a client application is: void callback_function(...) { } int main() { OBEX_Init(..., callback_function); OBEX_TransportConnect(...); object=OBEX_ObjectNew(...); OBEX_ObjectAddHeader(object, ...); OBEX_ObjectAddHeader(object, ...); OBEX_Request(..., object); while(...) OBEX_HandleInput(...) object=OBEX_ObjectNew(...); OBEX_ObjectAddHeader(object, ...); OBEX_Request(..., object); while(...) OBEX_HandleInput(...) OBEX_TransportDisconnect(handle); OBEX_Cleanup(handle); } Objects are sent by PyOBEXPyOBEX provides partial support for OBEX in Python.[2] ProfilesOBEX is the foundation for many higher-layer "profiles":
Supported devices
See also
References1. ^javax.obex API 2. ^*[https://pypi.python.org/pypi/PyOBEX PyOBEX] External links
2 : Infrared Data Association|Bluetooth |
|||||||||||||||||||||||||||||||||||||||||
随便看 |
|
开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。