Chapter 11. The Generic Object Exchange Profile

Introduction

The Generic Object Exchange Profile (GOEP) establishes a level of basic functionality, abstracted from the Object Exchange Protocol (OBEX). In providing this basic set of features and procedures, it then becomes sufficient to realise the object exchange usage models, which is the basis for the Object Push, Chapter 12, File Transfer, Chapter 13 and Synchronisation Profiles, Chapter 14.

In Figure 11-1, we illustrate the components that make up the OBEX functionality. At the upper-edge of the OBEX component, implementers will establish function primitives in the form of an Application Programming Interface (API).

The various protocols that form the building blocks of the Object Exchange specific usage models. It is at the upper-edge of the OBEX component that function primitives are created which, in turn, will be used by the higher-applications to realise usage models.

Figure 11-1. The various protocols that form the building blocks of the Object Exchange specific usage models. It is at the upper-edge of the OBEX component that function primitives are created which, in turn, will be used by the higher-applications to realise usage models.

In creating such an API, implementers may then realise their object exchange specific applications, where these applications have access to the API. With the various object exchange profiles available, the GOEP simply places a foundation from which these applications can then be developed; remember it is the governing profile [1] that will ultimately determine the end function.

In this chapter, generic procedures are established for all devices during interoperability. Furthermore, the behaviour of such devices is governed with simple rules that relate to the methods of sending and retrieving data, initialisation and certain characteristics with regard to their discoverability. These features and procedures are used to establish commonality between products, which will ultimately achieve a cohesive user experience.

The lack of a User Expectation section in this chapter should demonstrate and remind you that this profile establishes core functionality; it is the governing profile that will ultimately guide the user through specific expectations at the user interface level.

Profile Principles

The GOEP provides two new roles: a Client and a Server device. The client device is capable of pushing and pulling data objects to and from the server, whereas the server provides the facility to allow the client device to push and pull the data objects.

In Figure 11-3, we can see the components that make up the GOEP and it is these building blocks that are required to realise a compliant profile. In our introduction, we touched upon the notion that a set of features and procedures exist to help govern the operation of Bluetooth-enabled devices, which support the GOEP. The profile also provides clarification with regard to the dependencies, as shown in Figure 11-3 and describes how each component realises such functionality. Essentially, what is achieved here is a clear definition of the core component requirements that make up the Bluetooth protocol stack; we will discuss this in more detail later on.

Support for IrOBEX [2] in the Bluetooth protocol stack is required, where this component has been adopted by the Bluetooth Special Interest Group (SIG). It has been chosen specifically to allow ad-hoc connections to enable data transfer from one device to another. Tasks such as synchronisation and file transfer can take place between one or more [3] device, where such objects may include vCalendar, vCard, vMessage and so on. The OBEX component has been designed with portability in mind and, as such, any existing infra-red application may reside above OBEX and use Bluetooth as its underlying transport. In Figure 11-2 we provide a comparative illustration, which shows the architecture of the infra-red protocol stack. Similarly, any Bluetooth OBEX-specific application (that is, GOEP compliant applications), built upon the OBEX protocol, may use the infra-red protocol stack as its mode of transport. In Figure 11-1 and Figure 11-2, we illustrated the common OBEX component where function primitives are exposed and the underlying transport for the application remains transparent.

The various components that form the building blocks of the infra-red protocol stack. In similar usage models, the OBEX function primitives are exposed at the OBEX upper-edge, where applications have a transparent interface to the underlying mode of transport.

Figure 11-2. The various components that form the building blocks of the infra-red protocol stack. In similar usage models, the OBEX function primitives are exposed at the OBEX upper-edge, where applications have a transparent interface to the underlying mode of transport.

There are no fixed master-slave roles; this allows either device free to initiate and terminate a connection, although typically the client will initiate the primary connection, where inquiry and device discovery procedures are undertaken. Participating devices in this profile are required to perform bonding and pairing, where encryption may be offered as an option. In Figure 11-3, we illustrate the specific Bluetooth protocol stack components that are dependent upon a compliant profile.

The core components of the Bluetooth protocol stack are shown illustrating how the components of the GOEP are integrated.

Figure 11-3. The core components of the Bluetooth protocol stack are shown illustrating how the components of the GOEP are integrated.

In Table 11-1, clarification is provided with regard to the roles used within the context of this profile. In general, DeviceA represents the initiating party and DeviceB represents the accepting party. The terms are often used interchangeably when describing specific operations in various contexts and are provided here for reference.

This profile does not mandate the operation of a master-slave switch; this is specifically addressed by the needs of the governing profile. It is DeviceB that usually determines whether or not it has a need to become master. In one such example, DeviceB may already be the master of an existing piconet and therefore may insist that it remains master of that relationship. Alternatively, DeviceA may decide that a role-switch is not permitted and choose to remain master. In either case, the device may decide not to continue and fail the link establishment altogether.

It is advisable that the role-switch is performed immediately after the physical-link is established, where the connection request parameters [4] determine whether or not a role-switch can be performed. It is the governing profile that will determine whether or not master-slave switching is mandatory (see Object Push, Chapter 12, File Transfer Chapter 13 and Synchronisation Profiles, Chapter 14, for further examples).

Table 11-1. The list of behavioural characteristics that are typical for this profile.

CONFIGURATION

ROLE

DESCRIPTION

DeviceA

Client

This device is capable of pushing and pulling objects from the server. The client establishes a relationship with the server before data can be exchanged; the client will typically initiate the connection.

Initiator

This configuration describes the device that instigates the original connection or the device that wishes to initiate communication over an existing link.

DeviceB

Server

A server provides object exchange capability which, in turn, allows client devices to push and pull objects from the server. This type of device would typically accept connections from clients.

Acceptor

This configuration describes the process of the device accepting the initiated communication from DeviceA.

Lifting the Lid

Dependencies

In the following sections, we take an opportunity to explore in greater depth the dependencies that make up this profile. In Figure 11-4, we provide a conceptual illustration, representing the dependencies that make up the GOEP; the areas that are shaded are relevant to this profile. As you can see, the profile depends upon the basic functionality offered to us by the Generic Access Profile, Chapter 2, the Service Discovery Application Profile, Chapter 3 and the Serial Port Profile, Chapter 6. We will now discuss the basic requirements of these dependent components and any deviations that may occur from the basic functionality originally offered to us.

The dependent components of the Bluetooth protocol stack that make up the GOEP. The areas that are shaded are relevant to this profile.

Figure 11-4. The dependent components of the Bluetooth protocol stack that make up the GOEP. The areas that are shaded are relevant to this profile.

Generic Access

The GOEP relies upon the capabilities provided by the Generic Access Profile, Chapter 2. You may recall that a level of basic functionality is achieved through establishing a set of rules and procedures. It is these rules and procedures that are used to establish commonality between products, which will ultimately achieve a cohesive user experience. This section discusses the behavioural aspects of Bluetooth-enabled devices as outlined by the Generic Access Profile.

Let us take an opportunity to reflect upon the behavioural aspects of Bluetooth-enabled devices as outlined by the Generic Access Profile, Chapter 2. You may remember that the Generic Access Profile mandates certain rules and procedures that help govern the overall connectability, discoverability and security aspects of Bluetooth-enabled devices.

In Table 11-2, the basic set of procedures is illustrated, identifying functional expectations, which in turn govern operation. These procedures help us to determine the context in which a device would operate; for example, a device may wish to be discoverable for a period of time or it may require a level of security that differs from one device to another depending upon the services it is capable of offering.

In Table 11-3, we consider the specific set of operations that are required for this profile. In the table, you will notice features are marked with M (Mandatory), O (Optional), X (Excluded), C (Conditional) and N/A (Not Applicable); these determine what is expected from the features of the Generic Access Profile. The GOEP usually operates limited discoverability, but when such devices have no user interface then the general discoverability mode must be used.

Table 11-4 identifies the security requirements for this profile. You will also notice that these features are marked in a similar fashion to our previous table. In the Generic Access Profile, Chapter 2, Security Mode 1 is a non-secure mode, where Bluetooth-enabled devices will never initiate any security procedures; whereas Security Modes 2 and 3 initiate different levels of security procedures at various stages of connection establishment. In this instance, the profile mandates that support should be provided for at least Security Mode 2 or 3.

Table 11-2. The core set of procedures as required by most profiles.

PROCEDURES

DESCRIPTION

Discoverability Mode

This mode prescribes the overall discoverability of a device, allowing it to be placed into a non-discoverable, limited or general discoverable mode. The mode would allow devices to become generally available to other users or it can be restricted to personal use.

Connectability Mode

When determining a baseband connectable state, this mode is used to place a device into a connectable or non-connectable mode.

Pairing

Pairable and non-pairable modes are used to realise the security aspects when operating or intending to use a device. A device may require authentication and, as such, the user would be required to enter a Bluetooth Passkey. The pairing procedure starts the link key generation process which, in turn, allows authentication to take place.

In our final consideration of the basic rules and procedures that are required from the Generic Access Profile, the idle mode procedures outline behavioural characteristics when DeviceA chooses to initiate them against DeviceB. The procedures that are listed in Table 11-5 provide a clear indication of how a device should operate when performing such an activity.

Table 11-3. The illustration shows specific modes of operation that this profile depends upon to realise its compliant implementation.

MODES

CLIENT

SERVER

Non-discoverable

N/A

M

Limited Discoverable

N/A

C

General Discoverable

N/A

C

Non-connectable

N/A

O

Connectable

N/A

M

Non-pairable

N/A

M

Pairable

M

M

Table 11-4. The illustration shows specific security procedures that this profile depends upon to realise its compliant implementation.

PROCEDURE

CLIENT

SERVER

Authentication

M

M

Security Mode 1

M

M

Security Mode 2

C

C

Security Mode 3

C

C

The mechanism for providing device discoverability is the provision of a well structured FHS packet, which is shown in Figure 11-5. This packet is used to identify the remote device, where information such as BD_ADDR and clock offsets is determined. You may also notice from this packet that the Class of Device (CoD) field is also provided. This information is relayed to the user interface which, in turn, provides common characteristics about discovered devices. The CoD is used during the discovery mechanism to learn more about the type of device and what it may be capable of providing. This structure of information is depicted in Figure 11-6 and is made up of 3-bytes (or 24-bits as shown). The following sections consider the OBEX-based attributes, which will ultimately make use of the Service, Major and Minor Device Class fields.

The structure of the FHS packet used only for reference to illustrate the position of the CoD structure.

Figure 11-5. The structure of the FHS packet used only for reference to illustrate the position of the CoD structure.

The structure of the class of device, illustrating the Minor Device, Major Device and Service Class fields and their respective lengths.

Figure 11-6. The structure of the class of device, illustrating the Minor Device, Major Device and Service Class fields and their respective lengths.

Service Class

This high-level form of defining a Bluetooth device identifies where in the Service Class field the OBEX-based Profile resides (see Table 11-6) which, in turn, determines the category of service. Here, the category of service falls within Object Transfer.

Table 11-5. The illustration shows specific behavioural procedures that this profile depends upon to realise its compliant implementation.

PROCEDURE

CLIENT

SERVER

General Inquiry

M

N/A

Limited Inquiry

O

N/A

Name Discovery

M

N/A

Device Discovery

M

N/A

Bonding

M

M

Major Device Class

This high-level form of defining a Bluetooth device identifies where in the Major Device Class the category of device supporting the OBEX-based Profile resides (see Table 11-7). Here, the various categories of devices that may support the OBEX-based Profile are shown.

Minor Device Class

The Minor Device Class in this profile is used to convey further context for the setting within the major class grouping (see Table 11-8). Here, the bit may be set appropriately for Notebook, Handheld PDA or Palm-sized PDA to denote the type of device supporting the OBEX-based Profile. Further categorisation can also be provided for a Phone.

The Object Exchange Protocol

Earlier, we introduced the OBEX concept, whereby it is used as an independent layer and the mode of transport that sits beneath it remains transparent to the application. This provides flexibility in the use of a variety of applications as well as the ability to create ad-hoc connections between devices. This section describes the processes used to realise an OBEX-to-OBEX connection and establishes how the underlying Bluetooth transport is facilitated in achieving this.

Table 11-6. The Service Class categorisation for OBEX-based Profiles.

 

SERVICE CLASS

23

22

21

20

19

18

17

16

15

14

13

Bit # of CoD

0

0

0

1

0

0

0

0

0

0

0

Object Transfer

OBEX has been designed to sit above the RFCOMM component of the Bluetooth protocol stack, as shown in our earlier illustrations. You may remember that the same illustration presented an implementation, where OBEX can be placed above a Transmission Control Protocol (TCP), Internet Protocol (IP) component, which then resided above L2CAP. In our first look at understanding this protocol, we will look at its architecture in more detail and then consider specific aspects of integration over RFCOMM and TCP/IP. In later sections, we will discuss how OBEX operations such as Put, Get and so on are used to realise function primitives.

The Object Model and the Session Protocol

The OBEX specification provides a formal representation to achieve data object exchange between devices, using what is called an Object Model. This formal representation includes the provision of a Session Protocol, which is used to structure the nature of any communication and is based upon a format that includes a request-response client-server concept. Communication is transported through connection-orientated channels available through RFCOMM and L2CAP; the connectionless-specific transfer would impose interoperability issues between devices.

In our first detailed examination of the OBEX protocol, we look at the structure of the object model, which is used to represent data objects in OBEX. In Figure 11-7, we can see the object encompassing a Header ID followed by a number of Header Values. The HeaderID is made up of one byte and is further broken down into a two-bit and a six-bit segment. The purpose of such a structure is to provide a descriptive meaning to the objects being transferred and to carry the object itself. The two-bit segment is used to identify the type of encoding, whereas the six-bit segment is used to identify the header meaning.

The structure of the object model.

Figure 11-7. The structure of the object model.

Table 11-7. The Major Device Class categorisation for a device that supports the OBEX-based Profile.

 

MAJOR DEVICE CLASS

12

11

10

9

8

Bit # of CoD

0

0

0

0

1

Computer

0

0

0

1

0

Phone

Table 11-8. The Minor Device Class categorisation for a device that supports the OBEX-based Profile.

 

MINOR DEVICE CLASS

7

6

5

4

3

2

Bit # of CoD

0

0

0

0

1

1

Notebook

0

0

0

1

0

0

Handheld PDA

0

0

0

1

0

1

Palm-sized PDA

In Table 11-9, we show the six-bit segment format that is used in conjunction with Table 11-11; the table describes the header types that are available. The values presented in Table 11-11 provide a known set of header values that can be used for most applications. However, the header value range 0x30 to 0x3F are reserved for user or implementation-specific use. The range should accommodate the upper six bits of the HeaderID value; any user-defined header value must also accommodate the lower two-bit encoding method as shown in Table 11-10.

In establishing the object model, we turn our attention to the session protocol, which forms the request-response nature of exchanging OBEX objects between two devices. In simple terms, the client requests and the server responds; this essentially forms what is called the conversational format between two devices. In Figure 11-8, we can identify an OpCode, which is used to denote the type of request being sent to the server; this is followed by the two-byte Packet Length. You should further note in Figure 11-8 that the header information may also be included (see Figure 11-7); this, of course, depends upon the type of operation that is being requested.

The structure of the request packet contains the header parameters of our original object model.

Figure 11-8. The structure of the request packet contains the header parameters of our original object model.

When managing multi-packets during a request operation, it is the high-order bit in the OpCode that is used to denote the final packet and is referred to as the final bit.

One such example is with the PUT operation, where the object may need to be carried over several packets; however, the GET operation is a function that may require multiple responses. Here, the server will indicate to the client that it needs to continue; this is gleaned from the response packet and we will cover this in more detail shortly. In the meantime, Table 11-12 provides a summary of the operations that are available as function primitives.

Table 11-9. The lower six-bit HeaderID segment is used to describe the header type.

 

DESCRIPTION

5

4

3

2

1

0

Bit # of HeaderID

x

x

x

x

x

x

The lower six-bit segment describes the type of header.

We now turn our attention to the format of a response. In Figure 11-9, we can identify a Response Code, which is used to denote the type of response being returned to the client, followed by the two-byte Packet Length.

The structure of the request packet contains the header parameters of our original object model.

Figure 11-9. The structure of the request packet contains the header parameters of our original object model.

When managing multi-packets during a response operation, it is the high-order bit in the ResponseCode that is used to denote the final packet and is also referred to as the final bit. If you recall from our earlier example, the GET operation may require a number of packets to be retrieved from the server to fulfil the original request. The server indicates to the client, by setting the final bit in the ResponseCode, that several GET operations need to be performed before receiving the final packet. The final bit is also used to inform the client that the server is now ready to receive a new request, but how do we distinguish between more packets and a new operation? It is the ResponseCode type that is used to determine what the client should do. In our GET operation example, the final bit would be set and the value of the Response Code would be 0x10, indicating Continue (remember the final bit will be set so that the translated value will be 0x90). A further Response Code of 0x20 (remember that the final bit will be set so our translated value here will be 0xA0), indicates Success. The final bit being set would then appropriately inform the client that it can now continue with a new operation. See IrDA OBEX for a full definition of the response codes.

We have introduced the Object Model and the Session Protocol; in the following sections we consider the implementation of a basic set of APIs that are capable of fulfilling genuine functions for our applications. More specifically, we look at how these operations are constructed to enable their intended function. In later sections, we will discuss how OBEX supports the RFCOMM and TCP/IP transport models (see Section 11.3.1.2.8, OBEX over RFCOMM and Section 11.3.1.2.9, OBEX over TCP/IP).

Table 11-10. The higher two-bit segment of the HeaderID describes the encoding method for OBEX.

 

DESCRIPTION

 

7

6

Higher Bit # of HeaderID

VALUE

0

0

Two-byte length, null terminated Unicode String.

0x00

0

1

Two-byte length, with a byte sequence to follow.

0x40

1

0

A single-byte quantity.

0x80

1

1

Transmitted with high-byte first; this is a four-byte quantity.

0xC0

Table 11-11. The various header identifiers that are encoded in the first six bits of the HeaderID byte of the Object Model.

ID

NAME

DESCRIPTION

0xC0

Count

A four-byte unsigned integer, which is used to describe the number of objects joining this transaction.

0x01

Name

An optional description is available to describe the object; an example would be to provide the name of a file during a file transfer operation. This name is constructed using a null terminated Unicode string.

0x42

Type

This header is optional and assists in the identification of the type of object being transferred, which may include such objects as text, binary or vCard. If no type is indicated, then the default is assumed to be binary.

0xC3

Length

The length of the object is identified with this four-byte unsigned integer and again is optional since the length may be unknown. The End of Body may also indicate the end of an object.

0x44

Time

This provides the object with a formatted time and date stamp.

0xC4

0x05

Description

This optional header is used to provide a descriptive meaning to the object being transferred, but can also be used to provide further information in a response code. It is formatted using a null terminated Unicode string.

0x46

Target

A number of Bluetooth services exist and this item is used to identify that specific service. In such instances, 128-bit UUIDs[5] can be used to accomplish this identification. This is usually provided in a CONNECT or PUT operation, where it is directed to a particular service.

0x47

HTTP

An optional header that provides an HTTP 1.x header encompassing many of the features is already present in HTTP.

0x48

Body

The Body header contains the object being transferred, such as the contents of a file, where several body headers may be used to chunk or segment the data. The End of Body header is used to indicate the last chunk or segment and may be used instead of the Length header, where the size is unknown.

0x49

End of Body

0x4A

Who

The Who header is used to formally identify peer applications and it may be used in a CONNECT response operation. The UUID and target values are matched again using the 128-bit UUIDs encoding.

0xCB

ConnectionID

This optional header value is used to identify the origin of the OBEX connection, especially when multiple connections are being used. This header value is typically the first value to be sent in the request.

0x4C

Application Parameters

The Application Parameter header value is used to supply additional information about the application, which resides above the OBEX component.

0x4D

Authentication Challenge

A digest-challenge string is used to initiate the authentication procedures inherent within the remote device.

0x4E

Authentication Response

A digest-response string is used to respond to the authentication challenge originally initiated by the remote device.

0x4F

Object Class

An identification of the class and its associated properties are referenced with the Object Class header.

[5] A summary of known identifiers can be used where the Universally Unique Identifiers (UUIDs) values are used to distinguish the varying services on offer. For example, IrMC-SYNC is used to especially identify IrMC Synchronisation, whereas an identifier value of F9EC7BC4-953C-11D2-984E-525400DC9E09 is used to identify a folder browsing service.

Providing Basic Operations

Having established our functional primitives, we can now turn our attention to the APIs, as shown in Table 11-13. Here, we have a basic set of functions that are capable of being exposed at the upper-edge of our OBEX component; these functions are ready for integration with a chosen OBEX application.

In the following sections, we examine some of the typical functions that we may come across when implementing our OBEX-specific APIs. As such, the OBEX_Connect, OBEX_Disconnect, OBEX_Put, OBEX_Get and OBEX_SetPath will be discussed.

Table 11-12. The range of OBEX-related operations also identifying their specific OpCode values. These can be mapped to specific APIs that can then be exposed to our intended application.

OpCode

DEFINITION

DESCRIPTION

0x80

Connect

Create an OBEX connection.

0x81

Disconnect

Terminate an existing OBEX connection.

0x02

Put

Send a data object.

0x03

Get

Get a data object.

0x85

SetPath

Nominates an area to place the object on the receiving side.

0xFF

Abort

Halt the current operation.

Table 11-13. The range of OBEX-related API functions that can now be exposed to the OBEX-specific application.

API

OpCode

DEFINITION

OBEX_Connect

0x80

Connect

OBEX_Disconnect

0x81

Disconnect

OBEX_Put

0x02

Put

OBEX_Get

0x03

Get

OBEX_SetPath

0x85

SetPath

OBEX_Abort

0xFF

Abort

Connecting an OBEX Session

In our first examination, the OBEX_ Connect function, we look at how the Connect operation is encapsulated within the request packet (see Figure 11-10).

The structure of a Connect request packet.

Figure 11-10. The structure of a Connect request packet.

The Connect request packet is constructed and then used to establish a new OBEX session. Conversely, its response is shown in Figure 11-11; this will be parsed [6] to ascertain appropriate instructions by the client device. Let us take a closer look at the parameters that make up these two packets. Our OpCode, shown as 0x80 in Figure 11-10, always has the final bit set, since it is always communicated in one packet transaction. In our response, we indicate 0xA0 as our response code, since we are assuming a successful operation and again the final bit is set, indicating to the client that the server is ready to receive a new request. The PacketLength will accurately reflect the packet size in its entirety, whereas the OBEXVersion reflects the current IrDA OBEX specification (that is, Version 1.2). The FLAGS parameter has the default value of zero and is always ignored by the server. Finally, the OBEX PacketLength reflects the maximum packet size capable of being transferred, which is currently 64 KB (less one).

The structure of a Connect response packet.

Figure 11-11. The structure of a Connect response packet.

Disconnecting an OBEX Session

We have established an OBEX session and naturally we would wish to disconnect it at some point. As such, the OBEX_ Disconnect function will enable us to disconnect our established session. In Figure 11-12, we provide the structure of a Disconnect operation and how it is encapsulated within the request packet.

The structure of a Disconnect request packet.

Figure 11-12. The structure of a Disconnect request packet.

Conversely, its response is shown in Figure 11-13; this will be parsed to ascertain appropriate instructions by the client device. Let us take a closer look at the parameters that make up these two packets. Our OpCode, shown as 0x81 in Figure 11-12, always has the final bit set. It is always communicated in one packet transaction, which informs the server that it is ready to receive its response.

The structure of a Disconnect response packet.

Figure 11-13. The structure of a Disconnect response packet.

In our response, we indicate 0xA0 as our ResponseCode; note that we are assuming a successful operation and that the final bit is set, indicating to the client that the server is ready to receive a new request. The PacketLength will accurately reflect the packet size in its entirety.

Putting Data

The physical data transfer of objects is achieved through the use of OBEX_Put and OBEX_Get. In this section, we will consider the transfer of data from the client to the server. In Figure 11-14 and Figure 11-15 we provide the structure of a Put operation and how it is encapsulated within the request packet.

The structure of a Put request packet indicating that there is more data to be transferred.

Figure 11-14. The structure of a Put request packet indicating that there is more data to be transferred.

The structure of a Put request packet, which indicates that the final packet has been sent and that the client is now ready to receive a response.

Figure 11-15. The structure of a Put request packet, which indicates that the final packet has been sent and that the client is now ready to receive a response.

Conversely, its potential responses are shown in Figure 11-16 and Figure 11-17; subsequently, it will be parsed to ascertain an appropriate action by the client device. Let us take a closer look at the parameters that make up these two packets. Our OpCode, shown as 0x02 in Figure 11-14, does not have the final bit set. The client has a large amount of data to transfer and, as such, several packets will be required to transfer its payload. However, in Figure 11-15, the OpCode is shown as 0x82, which indicates to the server that it has now sent the final packet. It sets the final bit of the OpCode and is now ready to send a new request.

The structure of a Put response packet, indicating to the client that it may continue to transfer the data.

Figure 11-16. The structure of a Put response packet, indicating to the client that it may continue to transfer the data.

The structure of a Put response packet, indicating to the client that its Put operation has been completed successfully.

Figure 11-17. The structure of a Put response packet, indicating to the client that its Put operation has been completed successfully.

There are two possible responses during the course of this request. In the first, we may receive a ResponseCode of 0x90, which indicates a Continue as a result of the client indicating an OpCode of 0x02. If our OpCode does not have the final bit set and we are indicting to the server we have more data to transfer, then its response is Continue (see Figure 11-16). In our second indication, see Figure 11-17, we receive 0xA0 in our ResponseCode. This informs us that the data transfer was Successful on the basis that we sent the last packet and indicated as such with the OpCode of 0x82. Once we have received a successful indication, the client can then begin to send a new request. The PacketLength will accurately reflect the packet size in its entirety.

Getting Data

We will now consider the transfer of data from the server to the client. In Figure 11-18 and Figure 11-19, we provide the structure of a Get operation and how it is encapsulated within the request packet.

The structure of a Get request packet, indicating that there is more data to be retrieved as implied by the ResponseCode 0x90 (Continue).

Figure 11-18. The structure of a Get request packet, indicating that there is more data to be retrieved as implied by the ResponseCode 0x90 (Continue).

The structure of a Get request packet, indicating that the final packet has been collected as implied by the ResponseCode 0xA0 (Successful).

Figure 11-19. The structure of a Get request packet, indicating that the final packet has been collected as implied by the ResponseCode 0xA0 (Successful).

Conversely, its potential responses are shown in Figure 11-20 and Figure 11-21; it will be subsequently parsed to ascertain an appropriate action by the client device. Let us take a closer look at the parameters that make up these two packets. Our OpCode, shown as 0x03 in Figure 11-18, does not have the final bit set. The client has a large amount of data to collect and, as such, several packets will be retrieved to complete its payload. This is implied in the ResponseCode of 0x90, which indicates Continue. However, in Figure 11-19 the OpCode is shown as 0x83, which now indicates to the server that it has retrieved the final packet and sets the final bit of the OpCode; it is now ready to send a new request. This is implied in the ResponseCode of 0xA0, which indicates that the request has been Successful.

The structure of a Put response packet, indicating to the client that it may continue to transfer the data.

Figure 11-20. The structure of a Put response packet, indicating to the client that it may continue to transfer the data.

The structure of a Put response packet, indicating to the client that its Put operation has been completed successfully.

Figure 11-21. The structure of a Put response packet, indicating to the client that its Put operation has been completed successfully.

We have two possible responses during the course of this request. In the first, we may receive a ResponseCode of 0x90, which indicates a Continue as a result of the client indicating an OpCode of 0x03. If our OpCode does not have the final bit set and we are indicating to the server that we have more data to collect, then its response is Continue (see Figure 11-20). In our second indication, see Figure 11-21, we receive 0xA0 in our ResponseCode; this informs us that the data transfer was Successful on the basis that we sent the last packet and indicated as such with the OpCode of 0x83. Once we have received a successful indication, the client can then begin to send a new request. The PacketLength will accurately reflect the packet size in its entirety.

Setting a Location

During the transfer of data to and from the client, a specific location may be required to place the data in the directory [7] of the device. The OBEX_SetPath function is capable of performing such an operation and we can look specifically at how the SetPath operation is encapsulated within the request packet, as shown in Figure 11-20.

The SetPath request packet is constructed and then used to locate an area within the server’s file structure. Conversely, its response is shown in Figure 11-23; subsequently, it will be parsed to ascertain an appropriate action by the client device. Let us take a closer look at the parameters that make up these two packets. Our OpCode, shown as 0x85 in Figure 11-22, always has the final bit set since it is always communicated in one packet transaction.

The structure of a SetPath request packet.

Figure 11-22. The structure of a SetPath request packet.

The structure of a SetPath response packet.

Figure 11-23. The structure of a SetPath response packet.

In our response, we indicate 0xA0 as our response code, since we are assuming a successful operation and, again, the final bit is set, indicating to the client that the server is ready to receive a new request. The PacketLength will accurately reflect the packet size in its entirety, whereas the FLAGS parameter always has the default value of zero and is always ignored by the server. The CONSTANTS parameter is not used and is reserved for future use.

OBEX over RFCOMM

RFCOMM has been discussed extensively in the Serial Port Profile, Chapter 6. You may remember that RFCOMM provides serial port emulation and is capable of supporting multiple connections. The OBEX protocol has been designed to support RFCOMM, where a server must be capable of supporting several simultaneous connections. These connections must be registered in the Service Discovery Database, which we discussed in some detail in the Service Discovery Application Profile, Chapter 3. We will learn more of the dependencies of the GOEP as we move forward into the relevant sections later on in this chapter.

There are several assumptions that are made when a client issues a Connect request to the server. In the first assumption, we assume that the client is capable of connecting to the server on the basis that it has learned of the RFCOMM channel number from the Service Discovery Database. The second assumption is that the client then initiates the connection to the server, where it is awaiting a connection from the client.

The nature of RFCOMM dictates that it receives data as a byte stream and, as such, the data is collected and sent a byte at a time, using the Get and Put operations. The OBEX-parsing module of the OBEX component will await and identify an OpCode or ResponseCode, depending on the type of data it is expecting to receive. How will the parser know the end of the payload? You may remember that request and response packets have a PacketLength parameter, which informs us of the size of the payload in its entirety. As such, once the OpCode or ResponseCode is received, we know that the following two bytes represent the PacketLength. To disconnect from the server, the client issues the Disconnect-request packet, where the RFCOMM channel is subsequently closed.

OBEX over TCP/IP

We have come across TCP/IP in earlier chapters, but why does this protocol exist within the OBEX transport mechanism? One fundamental reason for using TCP/IP is the inherent reliability that is achieved by using this protocol; it should not be confused with any networking-related association.

The implementation to use TCP/IP as a mode of transport becomes further complicated. In Table 11-12, we illustrated a series of APIs that can be exposed to our OBEX-specific application. Within our OBEX component, we have to further manage the removal of several layers of encapsulation to retrieve the request or response packet enclosed within the TCP/IP structure (see RFC791 and RFC793). Again, the OBEX protocol has been designed to support TCP/IP, where a server must be capable of supporting several simultaneous connections. These connections must be registered in the Service Discovery Database, which we discussed in some detail in the Service Discovery Application Profile, Chapter 3.

There are several assumptions that are made when a client issues a Connect request to the server. First, we assume that the client is capable of connecting to the server. Since it has learned of the TCP port [8] number, the client subsequently initialises a socket. [9] Secondly, we assume that the client then initiates the connection to the server, where it is awaiting a connection from the client.

Data is sent and retrieved using the Put and Get request operations. The OBEX-parsing component of your application will await and identify an OpCode or ResponseCode, depending on the type of data it is expecting to receive. To disconnect from the server, the client issues the Disconnect-request packet, where the TCP port is subsequently closed.

OBEX in the Generic Object Exchange Profile

In Section 11.3.1.2, The OBEX Protocol, we learned how the request and response messages are created to provide us with basic functionality. We then went on to discuss how we could create an API and expose it to our application so that genuine functionality could be realised. We also learned that the OBEX component could parse incoming request and response packets, where an action can be decided based upon the encapsulated data. In this section, we consider the objectives and expectations of OBEX in the profile. In establishing our operations and primitive functionality, the profile discusses mandatory features that it expects from the protocol and provides guidance with regard to how a request and response packet should be constructed and subsequently used.

Initialisation and Establishing an OBEX Session

Prior to establishing an OBEX session, authentication must occur. An OBEX password may be required and can match the Bluetooth Passkey [10] for convenience; this itself reduces user complexity. Further convenience can be provided for the user as both the client and server may store the passkey for future ad-hoc connections.

As a minimum, GOEP must be able to support OBEX without authentication, but if it is requested, then support for the authentication challenge should be provided; we discuss this in Section 11.3.1.3.2, OBEX Connection with Authentication. In Figure 11-24, we provide a series of events that lead up to the establishment of an OBEX session with a server. In Table 11-14, we provide a list of mandatory fields that make up our request packets and provide further information with regard to their usage within the structure.

The sequence of events that are used to create a successful connection with the server.

Figure 11-24. The sequence of events that are used to create a successful connection with the server.

Table 11-14. The fields and headers that are a mandatory feature of the Connect-request operation.

NAME

TYPE

SUPPORT

OpCode

Field

M

PacketLength

Field

M

OBEXVersion

Field

M

FLAGS

Field

M

OBEXPacketLength

Field

M

Target

Header

C

As you know, the Connect request is used to establish the OBEX session and the Target header is used to identify the targeted service; in some OBEX-specific profiles, this header is mandatory. The Target header is used to identify the intended service; for instance, IrMC-SYNC may be indicated to identify the synchronisation service. The Connect response message is shown in Table 11-15; it is the expected response, where the ResponseCode will indicate 0xA0 if the transfer was successful. The ConnectionID and Who headers must be used if the Target header was used in the original Connect request.

Table 11-15. The fields and headers that are a mandatory feature of the Connect-response operation.

NAME

TYPE

SUPPORT

ResponseCode

Field

M

PacketLength

Field

M

OBEXVersion

Field

M

FLAGS

Field

M

OBEXPacketLength

Field

M

ConnectionID

Header

C

Who

Header

C

OBEX Connection with Authentication

In our previous section, we provided the scenario and features that are required to establish an OBEX session without authentication. This section now discusses the features expected from the OBEX protocol when authentication is required. This new authentication procedure is an additional requirement above the Bluetooth specific authentication process, that is, a Bluetooth Passkey is used to instigate the pairing process. The OBEX authentication is used to establish a trusted relationship at the client and server level, where it is the server that will initiate the challenge. The server is unable to commit to an OBEX session, until the authentication features are fully adhered to; in Figure 11-25, we illustrate the sequence of events that are used to establish this relationship. In the first instance of sending a Connect request, the client is unaware that authentication is required and, as such, it sends a request in the usual manner. The fields have been illustrated in Table 11-14.

The sequence of events that are used to create a successful authenticated connection with the server.

Figure 11-25. The sequence of events that are used to create a successful authenticated connection with the server.

The client learns of the news when it receives the response from the server. When we look more closely at the fields used in our Connect response (as shown in Table 11-16), we notice that the AuthenticationChallenge header is used. Furthermore, when the client parses the ResponseCode, it will learn of the value 0x41 Unauthorised; this notifies the client that it must send a new Connect request with the AuthenticationChallenge and AuthenticationResponse headers (as shown in Table 11-17); these headers carry the digest-challenge string and digest-response strings, respectively.

Table 11-16. The fields and headers that are a mandatory feature of the first Connect-response for authentication.

NAME

TYPE

SUPPORT

ResponseCode

Field

M

PacketLength

Field

M

OBEXVersion

Field

M

FLAGS

Field

M

OBEXPacketLength

Field

M

AuthenticationChallenge

Header

M

The fields and headers used in the second response are shown in Table 11-18. If the ResponseCode contains the value 0xA0 from the server, then authentication has been successful and the OBEX session can now be established.

Disconnecting an OBEX Session

At some point, a disconnection of the established OBEX session will be terminated, which may be due to a user request or a loss of connection. The session is terminated using the Disconnect operation, where the OpCode has the value 0x81. In Table 11-19, we show the remaining fields that are used during this operation.

Table 11-17. The fields and headers that are a mandatory feature of the second Connect-request for authentication.

NAME

TYPE

SUPPORT

OpCode

Field

M

PacketLength

Field

M

OBEXVersion

Field

M

FLAGS

Field

M

OBEXPacketLength

Field

M

Target

Header

C

AuthenticationChallenge

Header

M

AuthenticationReponse

Header

M

Table 11-18. The fields and headers that are a mandatory feature of the second Connect-response for authentication.

NAME

TYPE

SUPPORT

ResponseCode

Field

M

PacketLength

Field

M

OBEXVersion

Field

M

FLAGS

Field

M

OBEXPacketLength

Field

M

ConnectionID

Header

M

Who

Header

M

AuthenticationReponse

Header

M

The Disconnect response message is shown in Table 11-20. The ResponseCode will indicate 0xA0 if the disconnection was successful; this operation is not refused by the server.

Pushing Data to the Server

Data is transferred to the server using the Put request, where the OpCode may indicate 0x02, for multiple packets and 0x82 to indicate that it has sent the last packet. The features used for this transaction are identified in Table 11-21, where the ConnectionID is mandatory if the Target header was used in the original Connect request.

The Name header is used to identify the object being transferred and the Body/ End of Body headers are used to identify the start and end of the object being transferred. In Table 11-22, we identify the features that are required in the Put response, where the ResponseCode may indicate 0x90 for continue in response to the Put OpCode 0x02 or 0xA0 for successful in response to the Put OpCode for successful completion of the transfer.

Table 11-19. The fields and headers that are a mandatory feature of the Disconnect-request operation.

NAME

TYPE

SUPPORT

OpCode

Field

M

PacketLength

Field

M

Table 11-20. The fields and headers that are a mandatory feature of the Disconnect-response operation.

NAME

TYPE

SUPPORT

ResponseCode

Field

M

PacketLength

Field

M

Pulling Data from the Server

Data is transferred from the server using the Get request, where the OpCode may indicate 0x03, for multiple packets and 0x83 to indicate that it has retrieved the last packet. The features used for this transaction are identified in Table 11-21, where the ConnectionID is mandatory if the Target header was used in the original Connect request.

The Name header is used to identify the object being transferred and the Type header is used to identify the type of object being pulled. In Table 11-22, we identify the features that are required in the Get response, where the ResponseCode may indicate 0x90 for continue in response to the Get OpCode 0x03 or 0xA0 for successful in response to the Get OpCode for successful completion of the transfer. The Name header is used to identify the object being transferred and the Body/End of Body headers are used to identify the start and end of the object being pulled.

Locating Data Objects

A physical location on the server can be sought using the SetPath request, where the OpCode will indicate 0x85 and the Name header is used to contain the path name. The initial reference used by the server is the root directory. On the basis of this location, the server will reference down into the hierarchy to obtain the new location. For example, if the client requests My Documents in the Name header, it will effectively locate C:My Documents, on a typical Microsoft Windows based operating system or similar.

The FLAGS parameter is used to denote the type of action to be applied in locating the new directory; for example, where bit 0 is set to indicate that the directory needs to be moved up one level before applying the Name header. This is equivalent to .. on a Microsoft Windows environment or ../ on a Unix environment. Setting bit 1 recommends to the system that it should not create a directory if it already exists; otherwise an error must be reported to the user. The Constant parameter is not used and is reserved for future use.

Table 11-21. The fields and headers that are a mandatory feature of the Get-request operation.

NAME

TYPE

SUPPORT

OpCode

Field

M

PacketLength

Field

M

ConnectionID

Header

C

Name

Header

M

Body/End of Body

Header

M

Table 11-22. The fields and headers that are a mandatory feature of the Get-connect operation.

NAME

TYPE

SUPPORT

ResponseCode

Field

M

PacketLength

Field

M

Name

Header

O

Body/End of Body

Header

M

In the request-response packets for the SetPath operation, the final bit is always set since this transaction is made in one packet. In Table 11-24, we identify the features that are required in the SetPath response, where the ResponseCode may indicate 0xA0 for a successful operation. A ResponseCode of 0xC4 informs the client that the folder does not exist and a 0xC1 informs the client that folder browsing is not allowed.

RFCOMM

In the Serial Port Profile, Chapter 6, we introduced the conceptual and functional nature of RFCOMM and how it provides an emulated serial port presence. Several distinctions were made between the various types of applications. The purpose of making these distinctions was to enable clarification and understanding of RFCOMM’s composition. In this particular application context, the creation of an emulated serial port would be transparent to the user. The GOEP is dependent upon the operation of the Serial Port Profile and as such, is required to establish an emulated serial port as part of its communication link with the remote device.

The term cable replacement application was introduced in our earlier chapter and distinguishes between the different scenarios available. It refers to specific Bluetooth applications that create implicit emulated serial ports, which remain transparent to the user to complete the creation of a communications link.

Table 11-23. The fields and headers that are a mandatory feature of the SetPath request operation for data object location.

NAME

TYPE

SUPPORT

OpCode

Field

M

PacketLength

Field

M

FLAGS

Field

M

Constants

Field

M

Table 11-24. The fields that are a mandatory feature of the SetPath response.

NAME

TYPE

SUPPORT

ResponseCode

Field

M

PacketLength

Field

M

Specific detail has been provided to illustrate how data is communicated over an emulated serial port connection, whereby a Data Link Connection (DLC) is established between two peer devices, namely the client and server. We have also looked at the fields that make up our service record for this profile. The ProtocolDescriptorList field is used to describe the set of protocols that the profile intends to use and, as such, the RFCOMM protocol identifier contains a parameter, which contains the Server Channel number.

The Server Channel is used in combination with a Data Link Connection Identifier (DLCI), which is then used to uniquely identify the active DLC. This connection is then mapped onto a connectionless orientated L2CAP Channel Identifier (CID).

In this section we highlight the specific features that are required to realise a compliant GOEP. Table 11-25 and Table 11-26 illustrate the features or capabilities that are expected from the Serial Port Profile.

The use of the RLS command is encouraged to keep peer devices informed of any state change. In one such instance, an emulated serial port may interface to a Type II application (physical serial port), where overruns or parity errors may occur. An application that makes use of RS232 port configuration parameters should expose these settings through an appropriate API function; this is of particular relevance when interfacing to Type II applications.

L2CAP

The L2CAP layer provides transparency for the upper-layers of the stack from the layers typically found within the host controller. L2CAP payloads are passed to the Host Controller Interface [11] (HCI) and are then subsequently passed onto the Link Manager Protocol (LMP). The range of upper layers, which include RFCOMM, Service Discovery Protocol (SDP) and the Telephony Control Protocol Specification (TCS) all make use of the capabilities offered to us by L2CAP. Its primary role is to provide protocol multiplexing, allowing numerous simultaneous connections to be made and it also provides the ability for segmentation and reassembly. This refers to the ability to manage large payloads in the application, which may need to be fragmented into smaller payloads for the lower-layers to manage; these are then transmitted over the air-interface. Finally, the L2CAP layer exchanges Quality of Service (QoS) information, ensuring that sufficient resources are available and that both Bluetooth devices are attaining the best service.

Table 11-25. The set of capabilities that are required from the initiating party, denoted here by the client device.

PROCEDURE

CLIENT

SERVER

Initialise an RFCOMM Session

M

X

Terminate an RFCOMM Session

M

M

Establish a new DLC Connection

M

X

Disconnect a DLC Connection

M

M

Emulate RS232 Control Signals

C

C

Transfer Data

M

M

Test Command

X

X

Flow Control

C

C

RLS

O

O

PN

O

O

RPN

O

O

In Table 11-27, we summarise the broad capabilities that are expected from L2CAP. In the table, you will notice features are marked with M (Mandatory), O (Optional), X (Excluded), C (Conditional) and N/A (Not Applicable); these will determine what is expected from the L2CAP layer.

Channel Types

In Table 11-27, we have identified that Connection-Orientated Channels are mandatory, whereas Connectionless Channels are excluded; this type of channel is aimed at broadcasting, where all devices may be targeted. L2CAP uses Protocol Data Units (PDUs) to transport connection, signalling and configuration options, which will be discussed in a moment. The higher-layers of the Bluetooth protocol stack will instigate a connection with L2CAP using the L2CA_ConnectReq request packet, where the corresponding result is contained within the L2CA_ConnectRsp response packet. An L2CA_ConnectRspNeg negative response packet is used to denote a response, where the connection with the remote device was unsuccessful. Since our profile resides above L2CAP and employs its services, we are only concerned with the upper protocol layer of L2CAP. This higher functionality is offered to us through a series of L2CAP events and is denoted through the prefix L2CA_ (see Table 11-28).

Table 11-26. The set of capabilities that are required from the responder party, denoted here by the server device.

PROCEDURE

CLIENT

SERVER

Initialise an RFCOMM Session

X

M

Terminate an RFCOMM Session

M

M

Establish a new DLC Connection

X

M

Disconnect a DLC Connection

M

M

Emulate RS232 Control Signals

M

M

Transfer Data

N/A

N/A

Test Command

M

M

Flow Control

M

M

RLS

M

M

PN

M

M

RPN

M

M

When creating an L2CAP connection between two devices, a Protocol/Service Multiplexor (PSM) value is used to denote the higher-layer protocol that is using the connection. Table 11-29 identifies these values and the corresponding protocol they represent. The value of 0x0003 (RFCOMM) is used for this profile.

Signalling

When establishing communication with a remote device, a signalling channel is created and reserved for use during connection, disconnection and configuration of subsequent L2CAP connections. A channel is used to describe the communication and data flow that exists between L2CAP entities and Table 11-30 illustrates the range of CIDs that are used to identify the channel type. As we can see in Table 11-27, Connection Establishment and Termination is mandatory in the local device, although the remote device may be capable of initiating and terminating a connection to the local device. The L2CA_DisconnectReq request packet is used to terminate the connection with the remote device and an L2CA_DisconnectRsp response packet is used to ascertain the result of the termination. All disconnection requests must be completed successfully. The support of Configuration is shown as mandatory and we will discuss these specific options in more detail in the following section. Finally, Echo and Command Rejection are both mandatory for a compliant GOEP.

Configuration Options

In establishing a connection with the remote device, the channel is subject to configuration and the higher-layer prototype L2CA_ ConfigReq request packet is used to carry configuration requests. Its associated response is contained within the L2CA_ConfigRsp packet; an L2CA_ConfigRspNeg packet is used to denote a negative response during configuration where, for example, the suggested Maximum Transmission Unit (MTU) is too large. In Table 11-27, we show that the MTU and Flush Timeout parameters are mandatory, whereas the QoS is optional.

Table 11-27. The illustration shows specific procedures that this profile depends upon to realise its compliant implementation.

PROCEDURE

CLIENT

SERVER

Connection-orientated Channel

M

M

Connectionless Channel

X

X

Connection Establishment

M

M

Configuration

M

M

Connection Termination

M

M

Echo

M

M

Command Rejection

M

M

Maximum Transmission Unit

M

M

Flush Timeout

M

M

Quality of Service

O

O

The default MTU setting for the signalling channel is 48-bytes, whereas other channels may be capable of transferring larger payloads; essentially, the MTU determines the size of payloads that are capable of being exchanged between two devices. During configuration, the local device will inform the remote device that it is potentially capable of accepting larger payloads. If the remote device is unwilling to accept a larger MTU, then the local device is informed with the response contained within the L2CA_ConfigRspNeg packet.

Table 11-28. The range of prototypes used to illustrate how L2CAP is architected and how interaction between higher- and lower-layers is achieved. For this discussion, our concern here is with the higher-layer.

PROTOTYPE

DESCRIPTION

L2CA_

This prefix prototype is used to denote the higher-layer interaction, typically used by RFCOMM, SDP and TCS

L2CAP_

This prefix is used to denote peer-to-peer signalling interaction of L2CAP entities.

LP_

Finally, this prefix denotes lower-layer interaction, where L2CAP interfaces with the LMP layer.

Table 11-29. The PSM values that are used to identify the higher-layer protocol.

PSM

DESCRIPTION

0x0001

SDP

0x0003

RFCOMM

0x0005

TCS-BIN

0x0007

TCS-BIN-CORDLESS

When L2CA_ request and response packets are being exchanged, the Flush Timeout parameter is used to determine how long the local device is prepared to continue to transmit an L2CAP fragment before it gives up; the packet is subsequently flushed or, in other words, discarded. The suggested Flush Timeout value is sent during the L2CA_ ConfigReq request packet. However, if no value is set, then the default value is used. The GOEP uses the default value of 0xFFFF.

As we have already mentioned, the QoS configuration is optional. However, if it is used during an L2CA_ConfigReq request, then the best effort service is established as a default; the available services that are supported for an L2CAP channel are shown in Table 11-31. However, if the QoS service is set at Guaranteed, then parameters such Token Rate, Token Bucket, Peak Bandwidth, Latency and Delay Variation are used to determine an acceptable guaranteed service, where the L2CA_ConnectRspNeg will indicate that these values are unacceptable. These parameters are then subject to further negotiation.

Table 11-30. The CIDs that are used to represent the logical channel.

CID

DESCRIPTION

0x0000

Null

0x0001

Signalling Channel

0x0002

Connectionless Reception Channel

0x0003 to 0x003F

Reserved

0x0040 to 0xFFFF

Dynamically Allocated

Link Manager

The Link Manager (LM) layer sits between the HCI and the Link Controller (LC), although on a hostless system the LM will have direct interaction with L2CAP. It accepts commands from HCI and translates them into operations for the LC, where Asynchronous Connectionless (ACL) and Synchronous Connection-Orientated (SCO) links are created and established. It is during this stage of ACL and SCO establishment that a master-slave switch would be performed as governed by the requirements of this profile. The LM is also responsible for placing the device into a low-power mode, which includes hold, sniff and park.

In providing general error management, devices that operate mandatory procedures during interoperability must either acknowledge its support or provide a suitable reason informing the initiator why the procedure failed. The LMP_Detach PDU is used to inform the device of the error that occurred; typically, the reason unsupported LMP feature (0x1A) is reported (see Appendix A).

Link Controller

The LC layer is the lowest-layer depicted in the dependencies of this profile and is responsible for a large number of core capabilities. It manages air-to-interface transactions and determines the fundamental timing of ACL and SCO data packet transmission and reception, as well as coordinating the effort at its upper-edge with the LM. It also encompasses the management of the various packet types and the various inquiry and paging procedures that are available. In turn, the following subsections provide clarity with regard to the capabilities that are a requirement at the LC level for the GOEP. In our understanding of the dependencies, we begin by examining in more detail the supported capabilities and a small discussion is offered for each. If you are a developer providing profile-specific applications, then the likelihood for you to engage in a large part of this component is improbable, although, in some audio-related applications, direct access may be required, where a faster transport mechanism can be supported. Nevertheless, many manufacturers have architected an audio-specific API for intelligible access to this component.

Table 11-31. The range of service definitions that are used during QoS.

SERVICE

DESCRIPTION

No Traffic

This indicates that the channel will not be sending any traffic and, as such, any parameters can be ignored.

Best Effort

This default value attempts to achieve a minimum service with the local remote device, where no guarantees are offered.

Guaranteed

With this service definition, we indicate that we wish to achieve the maximum bandwidth permitted. This is, of course, subject to the nature of a wireless environment.

Capabilities

Table 11-32 summarises the broad capabilities that are expected from the LC. In the table, you will notice features are marked with M (Mandatory), O (Optional), X (Excluded), C (Conditional) and N/A (Not Applicable); these will determine what is expected from the features at the LC.

Inquiry and Inquiry Scan

An inquiry procedure is used to learn of the other devices in radio range, where the BD_ADDR and clock offsets are obtained; it is DeviceA that will enter an inquiry substate to perform this procedure. A device that wishes to be discovered (DeviceB) will enter an inquiry scan substate, where the device will respond with an inquiry response. In this state, DeviceB is waiting to receive an Inquiry Access Code (IAC). From an application perspective, these modes of operation are discussed in more detail in the Generic Access Profile, Chapter 2. It is here that specific rules are determined with regard to the behaviour of such devices and how long these devices can operate in such modes. When devices have been discovered, the information is passed over to the Service Discovery Application Profile, Chapter 3, which manages the specific attributes that make up that device. What is being established here, as a dependency, is that the Bluetooth protocol stack must encompass and support such behavioural procedures for this profile to be considered compliant.

Paging and Paging Scan

The inquiry substate and inquiry scan substate procedures are the initial methods used to learn of other devices in radio range; to this extent, the device has discovered sufficient information to gain a connection with the remote device. This is achieved when DeviceA has the intent to create a connection with DeviceB; DeviceA is now placed into a paging substate, where it will periodically transmit the Device Access Code (DAC). The DAC is used to target the device directly and the clock offset is used to gain an idea of the clock cycle of DeviceB. These parameters were originally obtained during our inquiry procedures. If DeviceB wishes to be connected, then it will enter a page scan substate and will respond accordingly to DeviceA. An inquiry procedure may be avoided if the BD_ADDR is already known, although a connection may take a little longer if the clock offset is not known.

Table 11-32. The summary of capabilities that are required for the LC to enable a compliant GOEP.

PROCEDURES

CLIENT

SERVER

Inquiry

M

X

Inquiry Scan

X

M

Paging

M

X

Page Scan

X

M

Inter-piconet

O

O

Packet Types

M

M

Voice Codecs

X

X

Inter-piconet

Inter-piconet capabilities describe the process that allows the master to manage multiple connections from slave devices. During a connection, other users may temporarily witness degradation in the service that is being provided; however, the master must be capable of accepting new participants in the piconet.

Packet Types

There are numerous packet types available and Table 11-33 identifies the most often used packets for profile support. There are also a number of common packet types used for general-purpose transport; for example, the ID packet is used for inquiry procedures and a POLL packet would be sent by DeviceA to determine if a slave is active on a channel.

The DM1 packet type is used to transmit control data over any connection, but may also be used to transport a genuine payload. HV1, HV2 and HV3 are various SCO packet types to carry audio-specific data, where a DV packet can combine ACL and SCO specific data; their support in this profile is reflected in Table 11-33. Various ACL packet types are also available. In fact, seven types including the DM1 type are attributed to carrying user-specific data. These include DH1, DM3, DH3, DM5, DH5 and AUX1; similarly, Table 11-33 summarises their support in this profile.

Table 11-33. The summary of packet types that are required for the LC to enable a compliant GOEP.

PACKET TYPE

CLIENT

SERVER

DM1

M

M

DH1

M

M

DM3

M

M

DH3

M

M

DM5

M

M

DH5

M

M

HV1

X

X

HV2

X

X

HV3

X

X

DV

X

X

Summary

  • All OBEX-specific profiles, such as the Object Push, File Transfer and Synchronisation are dependent upon the GOEP.

  • A governing profile may change the basic requirements of the GOEP to accommodate its own needs.

  • Features are defined to determine the behaviour of certain operations that govern connection, disconnection and push and pull behaviour.

  • The GOEP is based upon the OBEX protocol within the Bluetooth protocol stack.

  • An OBEX component would be responsible for exposing an API to the OBEX-specific profiles.

  • The OBEX protocol can be implemented upon RFCOMM and TCP/IP.

  • Certain characteristics define the OBEX features expected from the profile.

  • There are two levels of authentication for the client and server at the application level (Bluetooth and OBEX) although this is not mandatory.

  • No user expectations are described in the profile, as the governing profile determines the user characteristics.



[1] The reference to governing profile is used to distinguish the requirements of the GOEP and that of another object exchange-specific profile. The governing profile will sometimes require other features that may be mandatory, whereas the corresponding feature in the GOEP may be optional.

[2] IrOBEX has been shortened to OBEX and is provided by the non-profit organisation the Infra-red Data Association. The specification itself is the IrDA Object Exchange Protocol (OBEX™), Version 1.2, March 1999.

[3] The GOEP only discusses support for a point-to-point connection; nevertheless, it does not rule out multi-connection support, where many client devices are capable of pushing and pulling from a server device.

[4] The flexibility of the Bluetooth protocol stack, in particular the various HCI and LMP commands available, allow various methods of creating a successful ACL connection. The text refers to one particular example of a connection set-up.

[6] When receiving a response from the server, the response packet is parsed or disassembled to learn of the result (that is, whether it is a success or failure). This information is used to bias what the OBEX component should do next.

[7] A directory structure may be used to store the data objects in a specific location within the system file hierarchy; it should be noted that devices such as notebooks and PDAs utilise such methods of storage. On devices that do not support such a hierarchy, the server may respond with 0xC0, Bad Request or 0xC3, Forbidden.

[8] The server registers the appropriate TCP port number in the Service Discovery Database; this is typically port 650. Similarly, a client must assign an internal port number for it to communicate with the server; here a port number above 1023 is recommended, since some operating system deems that port numbers below 1023 are reserved for system use.

[9] The Microsoft Platform Software Development Kit provides a comprehensive set of APIs that allow you to dynamically create sockets (using WinSock) that are associated with specific TCP ports. In some cases, you may find that a minimum amount of parsing may be achieved, where access to the request and response packets can be made directly.

[10] The Bluetooth Passkey is a user-level entered parameter that is required for the pairing procedure and thus enables subsequent authentication.

[11] L2CAP payloads are passed directly onto LMP when implemented on a hostless system.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.46.58