Wireless Application Protocol: Unit - 5
Wireless Application Protocol: Unit - 5
The Wireless Application Protocol (WAP) is an open, global specification that empowers mobile
users with wireless devices to easily access and interact with information and services instantly.
WAP is a global standard and is not controlled by any single company. Ericsson, Nokia,
Motorola, and Unwired Planet founded the WAP Forum in the summer of 1997 with the initial
purpose of defining an industry-wide specification for developing applications over wireless
communications networks. The WAP specifications define a set of protocols in application,
session, transaction, security, and transport layers, which enable operators, manufacturers, and
applications providers to meet the challenges in advanced wireless service differentiation and
fast/flexible service creation.
reliable, i.e., provision of a consistent and predictable platform for deploying services;
and
secure, i.e., preservation of the integrity of user data, protection of devices and services
from security problems.
WAP utilizes Internet standards such as XML, user datagram protocol (UDP), and Internet
protocol (IP). Many of the protocols are based on Internet standards such as hypertext
transfer protocol (HTTP) and TLS but have been optimized for the unique constraints of the
wireless environment: low bandwidth, high latency, and less connection stability.
Internet standards such as hypertext markup language (HTML), HTTP, TLS and transmission
control protocol (TCP) are inefficient over mobile networks, requiring large amounts of
mainly text-based data to be sent. Standard HTML content cannot be effectively displayed
on the small-size screens of pocket-sized mobile phones and pagers.
WAP utilizes binary transmission for greater compression of data and is optimized for long
latency and low bandwidth. WAP sessions cope with intermittent coverage and can operate
over a wide variety of wireless transports.
WML and wireless markup language script (WML Script) are used to produce WAP content.
They make optimum use of small displays, and navigation may be performed with one
hand. WAP content is scalable from a two-line text display on a basic device to a full graphic
screen on the latest smart phones and communicators.
The lightweight WAP protocol stack is designed to minimize the required bandwidth and
maximize the number of wireless network types that can deliver WAP content. Multiple
networks will be targeted, with the additional aim of targeting multiple networks. These
include global system for mobile communications (GSM) 900, 1,800, and 1,900 MHz; interim
standard (IS)–136; digital European cordless communication (DECT); time-division multiple
access (TDMA), personal communications service (PCS), FLEX, and code division multiple
access (CDMA). All network technologies and bearers will also be supported, including short
message service (SMS), USSD, circuit-switched cellular data (CSD), cellular digital packet
data (CDPD), and general packet radio service (GPRS).
As WAP is based on a scalable layered architecture, each layer can develop independently
of the others. This makes it possible to introduce new bearers or to use new transport
protocols without major changes in the other layers.
2
Wireless Application Protocol (WAP)
Bluetooth, J2ME
WAP will provide multiple applications, for business and customer markets such as banking,
corporate database access, and a messaging interface.
WAP Architecture
The following figure gives an overview of the WAP architecture, its protocols and components,
and compares this architecture with the typical internet architecture when using the World
Wide Web. The basis for transmission of data is formed by different bearer services. WAP does
not specify bearer services, but uses existing data services and will integrate further services.
Examples are message services, such as short message service (SMS) of GSM, circuit-switched
data, such as high-speed circuit switched data (HSCSD) in GSM, or packet switched data, such as
general packet radio service (GPRS) in GSM. Many other bearers are supported, such as CDPD,
IS-136, PHS.
WDP: The WAP datagram protocol (WDP) and the additional Wireless control message protocol
(WCMP) is the transport layer that sends and receives messages via any available bearer
network, including SMS, USSD, CSD, CDPD, IS–136 packet data, and GPRS. The transport layer
3
Wireless Application Protocol (WAP)
Bluetooth, J2ME
service access point (T-SAP) is the common interface to be used by higher layers independent
of the underlying network.
WTLS: The next higher layer, the security layer with its wireless transport layer security protocol
WTLS offers its service at the security SAP (SEC-SAP). WTLS is based on transport layer security
(TLS, formerly SSL, secure sockets layer). WTLS has been optimized for use in wireless networks
with narrow-band channels. It can offer data integrity, privacy, authentication, and (some)
denial-of-service protection.
WTP: The WAP transaction protocol (WTP) layer provides transaction support, adding reliability
to the datagram service provided by WDP at the transaction SAP (TR-SAP).
WSP: The session layer with the wireless session protocol (WSP) currently offers two services at
the session-SAP (S-SAP), one connection-oriented and one connectionless if used directly on
top of WDP. A special service for browsing the web (WSP/B) has been defined that offers
HTTP/1.1 functionality, long-lived session state, session suspend and resume, session migration
and other features needed for wireless mobile access to the web.
WAE: The application layer with the wireless application environment (WAE) offers a
framework for the integration of different www and mobile telephony applications.
Working of WAP
WAP does not always force all applications to use the whole protocol architecture. Applications
can use only a part of the architecture. For example, if an application does not require security
but needs the reliable transport of data, it can directly use a service of the transaction layer.
Simple applications can directly use WDP.
4
Wireless Application Protocol (WAP)
Bluetooth, J2ME
Different scenarios are possible for the integration of WAP components into existing wireless
and fixed networks. On the left side, different fixed networks, such as the traditional internet
and the public switched telephone network (PSTN), are shown. One cannot change protocols
and services of these existing networks so several new elements will be implemented between
these networks and the WAP-enabled wireless, mobile devices in a wireless network on the
right-hand side.
WDP offers a consistent service at the Transport Service Access Point to the upper layer
protocol of WAP. This consistency of service allows for applications to operate transparently
over different available bearer services. WDP can be mapped onto different bearers, with
different characteristics. In order to optimise the protocol with respect to memory usage and
radio transmission efficiency, the protocol performance over each bearer may vary.
5
Wireless Application Protocol (WAP)
Bluetooth, J2ME
WDP offers source and destination port numbers used for multiplexing and demultiplexing of
data respectively. The service primitive to send a datagram is TDUnitdata. req with the
destination address (DA), destination port (DP), Source address (SA), source port (SP) , and
user data (UD) as mandatory parameters. Destination and source address are unique
addresses for the receiver and sender of the user data. These could be MSISDNs (i.e., a
telephone number), IP addresses, or any other unique identifiers. The T-DUnitdata.ind service
primitive indicates the reception of data. Here destination address and port are only optional
parameters.
6
Wireless Application Protocol (WAP)
Bluetooth, J2ME
Before data can be exchanged via WTLS, a secure session has to be established. This session
establishment consists of several steps: The following figure illustrates the sequence of service
primitives needed for a so-called ‘full handshake’.
The first step is to initiate the session with the SEC-Create primitive. Parameters are source
address (SA), source port (SP) of the originator, destinationaddress (DA), destination port
(DP) of the peer. The originator proposes a key exchange suite (KES) (e.g., RSA, DH, ECC), a
cipher suite (CS) (e.g., DES, IDEA ), and a compression method (CM). The peer answers with
parameters for the sequence number mode (SNM), the key refresh cycle (KR) (i.e., how
often keys are refreshed within this secure session), the session identifier (SID) (which is
unique with each peer), and the selected key exchange suite (KES’), cipher suite (CS’),
compression method (CM’). The peer also issues a SEC-Exchange primitive. This indicates
that the peer wishes to perform public-key authentication with the client, i.e., the peer
7
Wireless Application Protocol (WAP)
Bluetooth, J2ME
requests a client certificate (CC) from the originator. The first step of the secure session
creation, the negotiation of the security parameters and suites, is indicated on the originator’s
side, followed by the request for a certificate. The originator answers with its certificate and
issues a SEC-Commit.req primitive. This primitive indicates that the handshake is completed
for the originator’s side and that the originator now wants to switch into the newly negotiated
connection state. The certificate is delivered to the peer side and the SEC-Commit is indicated.
The WTLS layer of the peer sends back a confirmation to the originator. This concludes the full
handshake for secure session setup.
8
Wireless Application Protocol (WAP)
Bluetooth, J2ME
The PDUs exchanged between two WTP entities for normal transactions are the invoke PDU,
ack PDU, and result PDU. A special feature of WTP is its ability to provide a user
acknowledgement or, alternatively, an automatic acknowledgement by the WTP entity.
WTP Class 0
Class 0 offers an unreliable transaction service without a result message. The transaction is
stateless and cannot be aborted. The service is requested with the TR-Invoke.req primitive as
shown below. Parameters are same as in WDP.
Additionally, with the A flag, the user of this service can determine, if the responder WTP entity
should generate an acknowledgement or if a user acknowledgement should be used. The WTP
layer will transmit the user data (UD) transparently to its destination. The class type C
indicates here class 0. Finally, the transaction handle H provides a simple index to uniquely
9
Wireless Application Protocol (WAP)
Bluetooth, J2ME
identify the transaction and is an alias for the tuple (SA, SP, DA, DP), i.e., a socket pair, with only
local significance. The WTP entity at the initiator sends an invoke PDU which the responder
receives. The WTP entity at the responder then generates a TR-Invoke.ind primitive with the
same parameters as on the initiator’s side, except for H’ which is now the local handle for the
transaction on the responder’s side. WTP class 0 augments the transaction service with a simple
datagram like service for occasional use by higher layers.
WTP Class 1
Class 1 offers a reliable transaction service but without a result message. Again, the initiator
sends an invoke PDU after a TR-Invoke.req from a higher layer. This time, class equals ‘1’, and
no user acknowledgement has been selected as shown below.
The responder signals the incoming invoke PDU via the TR-Invoke.ind primitive to the higher
layer and acknowledges automatically without user intervention. For the initiator the
transaction ends with the reception of the acknowledgement. The responder keeps the
transaction state for some time to be able to retransmit the acknowledgement if it receives the
same invoke PDU again indicating a loss of the acknowledgement.
If a user of the WTP class 1 service on the initiator’s side requests a user acknowledgement on
the responder’s side, the sequence diagram looks like the following figure.
10
Wireless Application Protocol (WAP)
Bluetooth, J2ME
Now the WTP entity on the responder’s side does not send an acknowledgement automatically,
but waits for the TR-Invoke.res service primitive from the user. This service primitive must
have the appropriate local handle H’ for identification of the right tra nsaction. The WTP entity
can now send the ack PDU. Typical uses for this transaction class are reliable push services.
WTP Class 2
class 2 transaction service provides the classic reliable request/response transaction known
from many client/server scenarios. Depending on user requirements, many different scenarios
are possible for initiator/responder interaction. Three examples are presented below.
Example-1 scenario is shown below. A user on the initiator’s side requests the service and the
WTP entity sends the invoke PDU to the responder. The WTP entity on the responder’s side
indicates the request with the TR-Invoke.ind primitive to a user. The responder now waits for
the processing of the request, the user on the responder’s side can finally give the result UD* to
the WTP entity on the responder side using TR-Result.req. The result PDU can now be sent
back to the initiator, which implicitly acknowledges the invoke PDU.
The initiator can indicate the successful transmission of the invoke message and the result with
the two service primitives TR-Invoke.cnf and TR-Result.ind. A user may respond to this result
with TR-Result.res. An acknowledgement PDU is then generated which finally triggers the TR-
Result.cnf primitive on the responder’s side. This example clearly shows the combination of
11
Wireless Application Protocol (WAP)
Bluetooth, J2ME
In example-2, the user on the responder’s side now explicitly responds to the Invoke PDU using
the TR-Invoke.res primitive, which triggers the TR-Invoke.cnf on the initiator’s side via an
ack PDU. The transmission of the result is also a confirmed service, as indicated by the next
four service primitives. This service will likely be the most common in standard
request/response scenarios as, e.g., distributed computing.
12
Wireless Application Protocol (WAP)
Bluetooth, J2ME
If the calculation of the result takes some time, the responder can put the initiator on “hold on”
to prevent a retransmission of the invoke PDU as the initiator might assume packet loss if no
result is sent back within a certain timeframe, which is shown above. After a time-out, the
responder automatically generates an acknowledgement for the Invoke PDU. This shows the
initiator that the responder is still alive and currently busy processing the request. After more
time, the result PDU can be sent to the initiator.
Session management: WSP introduces sessions that can be established from a client to
a server and may be long lived. Sessions can also be released in an orderly manner. The
capabilities of suspending and resuming a session are important to mobile applications.
Capability negotiation: Clients and servers can agree upon a common level of protocol
functionality during session establishment. Example parameters to negotiate are
maximum client SDU size, maximum outstanding requests, protocol options, and server
SDU size.
Content encoding: WSP also defines the efficient binary encoding for the content it
transfers. WSP offers content typing and composite objects, as explained for web
browsing.
While WSP is a general-purpose session protocol, WAP has specified the wireless session
protocol/browsing (WSP/B) which comprises protocols and services most suited for browsing-
type applications, which offers the following features adapted to web browsing.
13
Wireless Application Protocol (WAP)
Bluetooth, J2ME
existing session context, and a non-confirmed data push without an existing session
context.
Asynchronous requests: Optionally, WSP/B supports a client that can send multiple
requests to a server simultaneously. This improves efficiency for the requests and
replies can now be coalesced into fewer messages.
The first example of session establishment of WSP/B using WTS class 2 transactions is shown
below:
With the S-Connect.req primitive, a client can request a new session. Parameters are the
server address (SA), the client address (CA), and the optional client header (CH) and
requested capabilities (RC). The session layer directly uses the addressing scheme of the layer
below. WTP transfers the connect PDU to the server S-SAP where an S-Connect.ind primitive
indicates a new session. Parameters are the same, but now the capabilities are mandatory. If
the server accepts the new session it answers with an S-Connect.res, parameters are an
optional server header (SH) with the same function as the client header and the negotiated
capabilities (NC) needed for capability negotiation. WTP now transfers the connreply PDU
back to the client; S-Connect.cnf confirms the session establishment and includes the server
header (if present) and the negotiated capabilities from the server. WSP/B includes several
procedures to refuse a session or to abort session establishment.
14
Wireless Application Protocol (WAP)
Bluetooth, J2ME
A very useful feature of WSP/B session suspension and session resume is shown below. A client
can suspend the session because of several reasons. Session suspension will automatically
abort all data transmission and freeze the current state of the session on the client and server
side. A client suspends a session with S-Suspend.req, WTP transfers the suspend PDU to the
server with a class 0 transaction, i.e., unconfirmed and unreliable. WSP/B will signal the
suspension with S-Suspend.ind on the client and server side. The only parameter is the reason
R for suspension. Reasons can be a user request or a suspension initiated by the service
provider.
Terminating a session is done by using the S-Disconnect.req service primitive as shown below.
15
Wireless Application Protocol (WAP)
Bluetooth, J2ME
This primitive aborts all current method or push transactions used to transfer data.
Disconnection is indicated on both sides using S-Disconnect.ind. The reason R for
disconnection can be, e.g., network error, protocol error, peer request, congestion, and
maximum SDU size exceeded.
The S-MethodInvoke primitive is used to request that an operation is executed by the server.
The result, if any, is sent back using the S-MethodResult primitive as shown below:
On the server’s side, S-MethodInvoke.ind indicates the request. In this case, a server
transaction identifier STID distinguishes between pending transactions. The server confirms
the request, so WSP/B does not generate a new PDU but relies on the lower WTP layer.
Similarly, the result of the request is sent back to the client using the SMethodResult primitive.
Additional parameters are now the status (S), the response header (RH), and the response
body (RB).
16
Wireless Application Protocol (WAP)
Bluetooth, J2ME
WSP does not introduce PDUs or service primitives just for the sake of symmetric and aesthetic
protocol architecture. The following figure shows how WSP (thus also WSP/B) uses the
underlying WTP services for its purposes. The S-MethodInvoke.req primitive triggers the TR-
Invoke.req primitive, the parameters of the WSP layer are the user data of the WTP layer. The
invoke PDU of the WTP layer carries the method PDU of the WSP layer inside.
For the confirmation of its service primitives the WSP layer has none of its own PDUs but uses
the acknowledgement PDUs of the WTP layer. S-MethodInvoke.res triggers TR-Invoke.res,
the ack PDU is transferred to the initiator, here TR-Invoke.cnf confirms the invoke service
and triggers the S-MethodInvoke.cnf primitive which confirms the method invocation service.
This mingling of layers saves a lot of redundant data flow but still allows a separation of the
tasks between the two layers.
With the help of push primitives, a server can push data towards a client if allowed. The
simplest push mechanism is the non-confirmed push as shown below.
17
Wireless Application Protocol (WAP)
Bluetooth, J2ME
The server sends unsolicited data with the S-Push.req primitive to the client. Parameters are
the push header (PH) and the push body (PB) again, these are the header and the body
known from HTTP. The unreliable, unconfirmed WTP class 0 transaction service transfers the
push PDU to the client where S-Push.ind indicates the push event.
A more reliable push service offers the S-ConfirmedPush primitive as shown below.
Here the server has to determine the push using a server push identifier (SPID). This helps to
distinguish between different pending pushes. The reliable WTP class 1 transaction service is
now used to transfer the confpush PDU to the client. On the client’s side a client push
identifier (CPID) is used to distinguish between different pending pushes.
Besides the server address (SA), the client address (CA), the method (M), and the
request URI (RU), the user of the S-Unit-MethodInvoke.req primitive can determine a
transaction identifier (TID) to distinguish between different transactions on the user level. TID
is communicated transparently from service user to service user.
18
Wireless Application Protocol (WAP)
Bluetooth, J2ME
The function of the S-Unit-MethodResult primitive remains the same as explained above: the
status (S), response header (RH), and response body (RB) represent the result of the
operation. The S-Unit-Push primitive has the parameters client address (CA), server address
(SA), push identifier (PID), push header (PH), and push body (PB).
19
Wireless Application Protocol (WAP)
Bluetooth, J2ME
The origin servers will respond to the request. The gateway now encodes the response
and its content (if there is any) and transfers the encoded response with the content to the
client. The WAE logical model not only includes this standard request/response scheme, but it
also includes push services. Then an origin server pushes content to the gateway. The gateway
encodes the pushed content and transmits the encoded push content to the client. Several user
agents can reside within a client. User agents include such items as: browsers, phonebooks,
message editors etc. WAE does not specify the number of user agents or their functionality, but
assumes a basic WML user agent that supports WML, WMLscript, or both (i.e., a ‘WML
browser’). However, one more user agent has been specified with its fundamental services, the
WTA user agent. This user agent handles access to, and interaction with, mobile telephone
features (such as call control). As over time many vendor dependent user agents may develop,
the standard defines a user agent profile (UAProf), which describes the capabilities of a user
agent.
WML follows a deck and card metaphor. A WML document is made up of multiple cards. Cards
can be grouped together into a deck. A WML deck is similar to an HTML page, in that it is
identified by a URL and is the unit of content transmission. A user navigates with the WML
browser through a series of WML cards, reviews the contents, enters requested data, makes
choices etc. The WML browser fetches decks as required from origin servers. Either these decks
can be static files on the server or they can be dynamically generated.WML describes the intent
of interaction in an abstract manner. The user agent on a handheld device has to decide how to
20
Wireless Application Protocol (WAP)
Bluetooth, J2ME
best present all elements of a card. This presentation depends much on the capabilities of the
device.
WML script
WMLScript complements to WML and provides a general scripting capability in the WAP
architecture. While all WML content is static (after loading on the client), WMLScript offers
several capabilities not supported by WML:
Validity check of user input: before user input is sent to a server, WMLScript can check
the validity and save bandwidth and latency in case of an error.
Access to device facilities: WMLScript offers functions to access hardware components and
software functions of the device.
Local user interaction: Without introducing round-trip delays, WMLScript can directly and
locally interact with a user, show messages or prompt for input.
Extensions to the device software: With the help of WMLScript a device can be configured
and new functionality can be added even after deployment.
21
Wireless Application Protocol (WAP)
Bluetooth, J2ME
BLUETOOTH
"Bluetooth" was the nickname of Harald Blåtland II, king of Denmark from 940 to 981, who
united all of Denmark and part of Norway under his rule. Bluetooth is a proprietary open
wireless technology standard for exchanging data over short distances (using short wavelength
radio transmissions in the ISM band from 2400-2480 MHz) from fixed and mobile devices,
creating personal area networks (PANs) with high levels of security. The Bluetooth technology
aims at so-called ad-hoc piconets, which are local area networks with a very limited coverage
and without the need for an infrastructure.
Bluetooth Features
Bluetooth is wireless and automatic. You don't have to keep track of cables, connectors, and
connections, and you don't need to do anything special to initiate communications. Devices
find each other automatically and start conversing without user input, expect where
authentication is required; for example, users must log in to use their email accounts.
Bluetooth is inexpensive. Market analysts peg the cost to incorporate Bluetooth technology
into a PDA, cell phone, or other product at a minimum cost.
The ISM band that Bluetooth uses is regulated, but unlicensed. Governments have
converged on a single standard, so it's possible to use the same devices virtually wherever
you travel, and you don't need to obtain legal permission in advance to begin using the
technology.
Bluetooth handles both data and voice. Its ability to handle both kinds of transmissions
simultaneously makes possible such innovations as a mobile hands-free headset for voice
with applications that print to fax, and that synchronize the address books on your PDA,
your laptop, and your cell phone.
Signals are omni-directional and can pass through walls and briefcases. Communicating
devices don't need to be aligned and don't need an unobstructed line of sight like infrared.
Bluetooth uses frequency hopping. Its spread spectrum approach greatly reduces the risk
that communications will be intercepted.
Bluetooth Applications
File transfer.
Ad-hoc networking: Communicating devices can spontaneously form a community of
networks that persists only as long as it's needed
22
Wireless Application Protocol (WAP)
Bluetooth, J2ME
The 802.11b protocol is designed to connect relatively large devices with lots of power and
speed, such as desktops and laptops, where devices communicate at up to 11 Mbit/sec, at
greater distances (up to 300 feet, or 100 meters). By contrast, Bluetooth is designed to connect
small devices like PDAs, mobile phones, and peripherals at slower speeds (1 Mbit/sec), within a
shorter range (30 feet, or 10 meters), which reduces power requirements. Another major
difference is that 802.11b wasn't designed for voice communications, while any Bluetooth
connection can support both data and voice communications.
User scenarios
Many different user scenarios can be imagined for wireless piconets or WPANs:
Connection of peripheral devices: Today, most devices are connected to a desktop computer
via wires (e.g., keyboard, mouse, joystick, headset, speakers). This type of connection has
several disadvantages: each device has its own type of cable, different plugs are needed, wires
block office space. In a wireless network, no wires are needed for data transmission. However,
batteries now have to replace the power supply, as the wires not only transfer data but also
supply the peripheral devices with power.
Support of ad-hoc networking: Imagine several people coming together, discussing issues,
exchanging data (schedules, sales figures etc.). For instance, students might join a lecture, with
the teacher distributing data to their personal digital assistants (PDAs). Wireless networks can
support this type of interaction; small devices might not have WLAN adapters following the IEEE
802.11 standard, but cheaper Bluetooth chips built in.
Bridging of networks: Using wireless piconets, a mobile phone can be connected to a PDA or
laptop in a simple way. Mobile phones will not have full WLAN adapters built in, but could have
a Bluetooth chip. The mobile phone can then act as a bridge between the local piconet and,
e.g., the global GSM network.
23
Wireless Application Protocol (WAP)
Bluetooth, J2ME
Networking in Bluetooth
Bluetooth operates on 79 channels in the 2.4 GHz band with 1 MHz carrier spacing. Each device
performs frequency hopping with 1,600 hops/s in a pseudo random fashion. A piconet is a
collection of Bluetooth devices which are synchronized to the same hopping sequence. One
device in the piconet can act as master (M), all other devices connected to the master must act
as slaves (S). The master determines the hopping pattern in the piconet and the slaves have to
synchronize to this pattern. Each piconet has a unique hopping pattern. If a device wants to
participate it has to synchronize to this. A typical piconet is shown below:
Parked devices (P) can not actively participate in the piconet (i.e., they do not have a
connection), but are known and can be reactivated within some milliseconds. Devices in stand-
by (SB) do not participate in the piconet. Each piconet has exactly one master and up to seven
simultaneous slaves. More than 200 devices can be parked. The first step in forming a piconet
involves a master sending its clock and device ID. All the Bluetooth devices have the same
capability to become a master or a slave and two or three devices are sufficient to form a
piconet. The unit establishing the piconet automatically becomes the master, all other devices
will be slaves. The hopping pattern is determined by the device ID, a 48-bit worldwide unique
identifier.
The phase in the hopping pattern is determined by the master’s clock. After adjusting
the internal clock according to the master a device may participate in the piconet. All active
devices are assigned a 3-bit active member address (AMA). All parked devices use an 8-bit
parked member address (PMA). Devices in stand-by do not need an address.
24
Wireless Application Protocol (WAP)
Bluetooth, J2ME
A device in one piconet can communicate to another device in another piconet, forming a
scatternet. A master in one piconet may be a slave in another piconet. Both piconets use a
different hopping sequence, always determined by the master of the piconet. Bluetooth applies
FH-CDMA for separation of piconets. A collision occurs if two or more piconets use the same
carrier frequency at the same time. This
will probably happen as the hopping
sequences are not coordinated. If a device
wants to participate in more than one
piconet, it has to synchronize to the
hopping sequence of the piconet it wants
to take part in. If a device acts as slave in
one piconet, it simply starts to
synchronize with the hopping sequence of
the piconet it wants to join. After
synchronization, it acts as a slave in this
piconet and no longer participates in its
former piconet. To enable
synchronization, a slave has to know the
identity of the master that determines the
hopping sequence of a piconet. Before
leaving one piconet, a slave informs the current master that it will be unavailable f or a certain
amount of time. The remaining devices in the piconet continue to communicate as usual.
A high-level view of the architecture is shown. The responsibilities of the layers in this stack are
as follows:
The radio layer is the physical wireless connection. To avoid interference with other devices
that communicate in the ISM band, the modulation is based on fast frequency hopping.
Bluetooth divides the 2.4 GHz frequency band into 79 channels 1 MHz apart (from 2.402 to
2.480 GHz), and uses this spread spectrum to hop from one channel to another, up to 1600
25
Wireless Application Protocol (WAP)
Bluetooth, J2ME
26
Wireless Application Protocol (WAP)
Bluetooth, J2ME
by the application, or through certain support protocols provided to ease the burden on
application programmers.
The Logical Link Control and Adaptation Protocol (L2CAP) receives application data and
adapts it to the Bluetooth format. Quality of Service (QoS) parameters are exchanged at this
layer.
27
Wireless Application Protocol (WAP)
Bluetooth, J2ME
Bluetooth defines several low-power states for a device. The following figure shows the major
states of a Bluetooth device and typical transitions. Every device, which is currently not
participating in a piconet (and not switched off), is in standby mode. This is a low-power mode
where only the native clock is running. The next step towards the inquiry mode can happen in
two different ways. Either a device wants to establish a piconet or a device just wants to listen
to see if something is going on.
If the inquiry was successful, a device enters the page mode. The inquiry phase is not
coordinated, so it may take a while before the inquiry is successful. After a while , a Bluetooth
device sees all the devices in its radio range.
28
Wireless Application Protocol (WAP)
Bluetooth, J2ME
During the page state two different roles are defined. After finding all required devices the
master is able to set up connections to each device, i.e., setting up a piconet. As soon as a
device synchronizes to the hopping pattern of the piconet it also enters the connection state.
The connection state comprises the active state and the low power states: park, sniff, and hold.
In the active state the slave participates in the piconet by listening, transmitting, and receiving.
ACL and SCO links can be used. A master periodically synchronizes with all slaves. All devices
being active must have the 3-bit active member address (AMA). To save battery power, a
Bluetooth device can go into one of three low power states:
Sniff state: The sniff state has the highest power consumption of the low power states.
Here, the device listens to the piconet at a reduced rate (not on every other slot as is the
case in the active state). The interval for listening into the medium can be programed and is
application dependent. The master designates a reduced number of slots for transmission
to slaves in sniff state. However, the device keeps its AMA.
Hold state: The device does not release its AMA but stops ACL transmission. A slave may
still exchange SCO packets. If there is no activity in the piconet, the slave may either reduce
power consumption or participate in another piconet.
Park state: In this state the device has the lowest duty cycle and the lowest power
consumption. The device releases its AMA and receives a parked member address (PMA).
The device is still a member of the piconet, but gives room for another device to become
active (AMA is only 3 bit, PMA 8 bit). Parked devices are still FH synchronized and wake up
at certain beacon intervals for re-synchronization. All PDUs sent to parked slaves are
broadcast.
L2CAP
The logical link control and adaptation protocol (L2CAP) is a data link control protocol on top of
the baseband layer offering logical channels between Bluetooth devices with QoS properties.
L2CAP is available for ACLs only.
L2CAP provides three different types of logical channels that are transported via the ACL
between master and slave:
Connectionless: These unidirectional channels are typically used for broadcasts from a
master to its slave(s).
Connection-oriented: Each channel of this type is bi-directional and supports QoS flow
specifications for each direction. These flow specs follow RFC 1363 and define average/peak
data rate, maximum burst size, latency, and jitter.
29
Wireless Application Protocol (WAP)
Bluetooth, J2ME
Signaling: This third type of logical channel is used to exchanging signaling messages
between L2CAP entities.
Each channel can be identified by its channel identifier (CID). Signaling channels always use a
CID value of 1, a CID value of 2 is reserved for connectionless channels. For connection-oriented
channels a unique CID (>= 64) is dynamically assigned at each end of the channel to identify the
connection.
The following figure shows the three packet types belonging to the three logical channel types.
The length field indicates the length of the payload (plus PSM for connectionless PDUs). The
CID has the multiplexing/demultiplexing function. For connectionless PDUs a protocol/service
multiplexor (PSM) field is needed to identify the higher layer recipient for the payload. For
connection-oriented PDUs the CID already fulfills this function. Several PSM values have been
defined, e.g., 1 (SDP), 3 (RFCOMM), 5 (TCS-BIN). Values above 4096 can be assigned
dynamically. The payload of the signaling PDU contains one or more commands. Each
command has its own code (e.g., for command reject, connection request, disconnection
response etc.) and an ID that matches a request with its reply. The length field indicates the
length of the data field for this command.
Besides protocol multiplexing, flow specification, and group management, the L2CAP layer also
provides segmentation and reassembly functions. Depending on the baseband capabilities,
large packets have to be chopped into smaller segments.
30
Wireless Application Protocol (WAP)
Bluetooth, J2ME
Security
The main security features offered by Bluetooth include a challenge response routine for
authentication, a stream cipher for encryption, and a session key generation. Each connection
may require a one-way, two-way, or no authentication using the challenge-response routine.
The security algorithms use the public identity of a device, a secret private user key, and an
internally generated random key as input parameters. For each transaction, a new random
number is generated on the Bluetooth chip. Key management is left to higher layer software.
The following figure shows several steps in the security architecture of Bluetooth.
31
Wireless Application Protocol (WAP)
Bluetooth, J2ME
Based on the link key, and again a random number an encryption key is generated
during the encryption stage of the security architecture. This key has a maximum size of 128
bits and can be individually generated for each transmission. Based on the encryption key, the
device address and the current clock a payload key is generated for ciphering user data. The
payload key is a stream of pseudo-random bits. The ciphering process is a simple XOR of the
user data and the payload key.
All Bluetooth-enabled devices must implement the Generic Access Profile, which contains all
the Bluetooth protocols and possible devices. This profile defines a security model that includes
three security modes:
Though Bluetooth offers a better security than WER in 802.11, it has several limitations. The
PIN’s are often fixed and some keys are permanently stored on the devices. The quality of the
random number generators has not been specified.
SDP
To find new services available in the radio proximity, Bluetooth defined the service discovery
protocol (SDP). SDP defines only the discovery of services, not their usage. Discovered services
can be cached and gradual discovery is possible. All the information an SDP server has about a
service is contained in a service record. This consists of a list of service attributes and is
identified by a 32-bit service record handle.
A service attribute consists of an attribute ID and an attribute value. The 16-bit attribute
ID distinguishes each service attribute from other service attributes within a service record. The
attribute ID also identifies the semantics of the associated attribute value. The attribute value
can be an integer, a UUID (universally unique identifier), a string, a Boolean, a URL (uniform
resource locator) etc.
32
Wireless Application Protocol (WAP)
Bluetooth, J2ME
Bluetooth Profiles
Bluetooth profiles are intended to ensure interoperability among Bluetooth-enabled devices
and applications from different manufacturers and vendors. A profile defines the roles and
capabilities for specific types of applications. Profiles represent default solutions for a certain
usage model. They use a selection of protocols and parameter set to form a basis for
interoperability. Protocols can be seen as horizontal layers while profiles are vertical slices as
shown below:
The following basic profiles have been specified: generic access, service discovery, cordless
telephony, intercom, serial port, headset, dialup networking, fax, LAN access, generic object
exchange, object push, file transfer, and synchronization. Additional profiles are: advanced
audio distribution, PAN, audio video remote control, basic printing, basic imaging, extended
service discovery, generic audio video distribution, hands-free, and hardcopy cable
replacement. Some of the profiles are given below:
The Generic Access Profile defines connection procedures, device discovery, and link
management. It also defines procedures related to use of different security models and
common format requirements for parameters accessible on the user interface level. At a
minimum all Bluetooth devices must support this profile.
The Service Discovery Application and Profile defines the features and procedures for an
application in a Bluetooth device to discover services registered in other Bluetooth devices,
and retrieves information related to the services.
The Serial Port Profile defines the requirements for Bluetooth devices that need to set up
connections that emulate serial cables and use the RFCOMM protocol.
The LAN Access Profile defines how Bluetooth devices can access the services of a LAN using
PPP, and shows how PPP mechanisms can be used to form a network consisting of
Bluetooth devices.
33
Wireless Application Protocol (WAP)
Bluetooth, J2ME
The Synchronization Profile defines the application requirements for Bluetooth devices that
need to synchronize data on two or more devices.
While connected consumer devices such as cell phones, pagers, personal organizers and set-top
boxes have many things in common, they are also diverse in form, function and features.
Information appliances tend to be special-purpose, limited-function devices. To address this
diversity, an essential requirement for J2ME is not only small size but also modularity and
customizability. The J2ME architecture is modular and scalable so that it can support the kinds
of flexible deployment demanded by the consumer and embedded markets. To support this
kind of customizability and extensibility, two essential concepts are defined by J2ME:
34
Wireless Application Protocol (WAP)
Bluetooth, J2ME
class libraries that are far more domain-specific than the class libraries provided in a
configuration.
Configurations
A configuration is a subset of profile. A configuration defines a Java platform for a “horizontal”
category or grouping of devices with similar requirements on total memory budget and other
hardware capabilities. More specifically, a configuration:
35
Wireless Application Protocol (WAP)
Bluetooth, J2ME
is used with the C virtual machine (CVM) and is used for 32-bit architectures requiring more
than 2 MB of memory.
J2ME Universe
Wireless Application Protocol (WAP)
Bluetooth, J2ME
Profiles
The J2ME framework provides the concept of a profile to make it possible to define Java
platforms for specific vertical markets. Profiles can serve two distinct portability requirements:
A profile provides a complete toolkit for implementing applications for a particular kind
of device, such as a pager, set-top box, cell phone, washing machine, or interactive
electronic toy.
A profile may also be created to support a significant, coherent group of applications
that might be hosted on several categories of devices.
Foundation profile contains APIs of J2SE without GUIs. PersonalProfile is profile for embedded
devices. Two profiles have been defined for J2ME and are built on CLDC: KJava and Mobile
Information Device Profile (MIDP). These profiles are geared toward smaller devices.
MIDP 3.0 is the latest profile version, which is a profile for special-featured phones and
handheld devices. It provides improved UI’s, UI extensibility and interoperability between the
devices. It supports multiple network interfaces in a device, IPv6, large display devices and high
performance games. Development tools are used to develop MIDP applications. MIDP
applications are composed of two parts:
JAR File – Contains all of the classes and resources used by the application
JAD File – Application descriptor, describes how to run the MIDP application
1 Java.lang standard java types and classes for String, Integer, Math, Thread,
Security and Exception
2 Java.io Standard java types and classes for input and output streams
4 Javax.microedition.rms A record management system (RMS) API to retrieve and save data
and limited querying capability
K Virtual Machine
The KVM is a compact, portable Java virtual machine specifically designed from the ground up
for small, resource-constrained devices. The high-level design goal for the KVM was to create
the smallest possible “complete” Java virtual machine that would maintain all the central
aspects of the Java programming language, but would run in a resource-constrained device with
only a few hundred kilobytes total memory budget. More specifically, the KVM was designed to
be:
small, with a static memory footprint of the virtual machine core in the range of 40
kilobytes to 80 kilobytes (depending on compilation options and the target platform,)
clean, well-commented, and highly portable,
modular and customizable, as “complete” and “fast” as possible without sacrificing the
other design goals.
The “K” in KVM stands for “kilo.” It was so named because its memory budget is measured in
kilobytes (whereas desktop systems are measured in megabytes). KVM is suitable for 16/32-bit
RISC/CISC microprocessors with a total memory budget of no more than a few hundred
kilobytes (potentially less than 128 kilobytes). This typically applies to digital cellular phones,
pagers, personal organizers, and small retail payment terminals.
38
www.jntuworld.com
Wireless Application Protocol (WAP)
Bluetooth, J2ME
Assignment Questions
39
www.jntuworld.com