Download Bluetooth for Java

Transcript
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
Back Cover
ISBN:1590590783
by Bruce Hopkins and Ranjith Antony
Bluetooth is a technology for wireless communication. It is similar in functionality to the way laptops connect to the
Apress © 2003 (352 pages)
Internet from home/office, but is typically used for short burst communications instead of a continuous connection.
The authors
of this
to develop
wireless
Java phones and personal devices.
Because of this difference,
Bluetooth
is text
moredescribe
typicallyhow
found
supported
in wireless
using of
Bluetooth
for In
a variety
of platforms.
This and Ranjith Antony describe how to
Bluetooth for Java isapplications
not an overview
Bluetooth.
the book,
Bruce Hopkins
includes
an APIusing
overview
of thefor
Java
library,ofdevelopment
of includes an API overview of the
develop wireless Java
applications
Bluetooth
a variety
platforms. This
Bluetooth-based
services, services,
highlightshighlights
of security
and
Java library, development
of Bluetooth-based
ofconcerns,
security concerns,
and walkthroughs for
more.
development with some
of the different tools available. Programs will not be just J2ME (micro devices) based, but
will also be for J2SE (client/desktop).
Table of Contents
About the Authors
Bluetooth for Java
Bruce Hopkins is an early adopter of Java technology, and has used it in a wide variety of applications, ranging from
Introduction
embedded
systems to enterpise applications. He currently works as a technical architect at Redwood Solutions, an
Chapter
1 firm
- Introducing
IT
services
in Livonia, Bluetooth
Michigan.
Chapter 2 - Bluetooth 1.1
Ranjith Antony is the technical lead for Atinav, an early Bluetooth "provider"/adopter.
Chapter 3 - Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
Bluetooth
for Java
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
Apress
BRUCE HOPKINS
AND© 2003 (352 pages)
The authors of this text describe how to develop wireless Java
RANJITH ANTONY
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
Table of Contents
Copyright © 2003 by Bruce Hopkins and Ranjith Antony
Bluetooth for Java
Introduction
All rights
No part
of this work may be reproduced or transmitted in any form or by any means,
Chapter
1 reserved.
- Introducing
Bluetooth
electronic
mechanical,
Chapter
2 -orBluetooth
1.1 including photocopying, recording, or by any information storage or retrieval
system,3 without
theYou
prior
written
permission of the copyright owner and the publisher.
Chapter
- Before
Get
Started
ISBN (pbk):
1-59059-078-3the Java Bluetooth API
Chapter
4 - Understanding
Chapter 5
- Bluetooth with J2ME MIDP
Printed and
bound in the United States of America 12345678910
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter
Trademarked
7 - Java
names
and OBEX
may appear in this book. Rather than use a trademark symbol with every occurrence
of a trademarked
we use
the names only in an editorial fashion and to the benefit of the trademark
Chapter
8 - Using aname,
Bluetooth
Simulator
owner, 9with- Bluetooth
no intention
of infringement of the trademark.
Chapter
Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Technical Reviewer: Andrew Stringer
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter
12 Directors:
- Bluetooth Dan
and Jini
Editorial
Appleman, Gary Cornell, Simon Hayes, Karen Watterson, John Zukowski
Appendix A - javax.bluetooth
Assistant
Appendix
B -Publisher:
javax.obex Grace Wong
Appendix C - Java Bluetooth Development on the PalmOS Platform
Project Manager and Development Editor: Tracy Brown Collins
Appendix D - BlipNet 1.1 API
Index
Copy Editor: Ami Knox
List of Figures
Compositor:
Impressions Book and Journal Services, Inc.
List
of Tables
List of Listings
Artist and Cover Designer: Kurt Krames
List of Sidebars
Indexer: Valerie Robbins
Production Manager: Kari Brooks
Manufacturing Manager: Tom Debolski
Distributed to the book trade in the United States by Springer-Verlag New York, Inc., 175 Fifth Avenue,
New York, NY, 10010 and outside the United States by Springer-Verlag GmbH & Co. KG, Tiergartenstr.
17, 69112 Heidelberg, Germany.
In the United States, phone 1-800-SPRINGER, email <[email protected]>, or visit
http://www.springer-ny.com.
Outside the United States, fax +49 6221 345229, email <[email protected]>, or visit
http://www.springer.de.
For information on translations, please contact Apress directly at 2560 9th Street, Suite 219, Berkeley, CA
94710. Phone 510-549-5930, fax: 510-549-5939, email <[email protected]>, or visit
http://www.apress.com.
The information in this book is distributed on an "as is" basis, without warranty. Although every precaution
has been taken in the preparation of this work, neither the author nor Apress shall have any liability to any
person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by
the information contained in this work.
Bluetooth for Java
ISBN:1590590783
The source codeby
forBruce
this book
Hopkins
is available
and Ranjith
to readers
Antony at http://www.apress.com
in the Downloads
Apress © 2003 (352 pages)
section.
The authors of this text describe how to develop wireless Java
First and foremost,
I dedicateusing
this book
to thefor
Lord
JesusofChrist,
without
applications
Bluetooth
a variety
platforms.
Thiswhom I could not have written
includes an
overview
of the Java
this book. I also dedicate
thisAPI
book
to my loving
wife,library,
Schrell,development
and my twoofwonderful children, Lydia and
Bluetooth-based services, highlights of security concerns, and
Bruce Jr.
more.
—Bruce Hopkins
Table
of Contents
Dedicated
to my parents, Prof. Antony Mampilly and Prof. Kochurani Mampilly.
Bluetooth for Java
—Ranjith Antony
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
About the Authors
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix
B - javax.obex
Bruce Hopkins
is a 6-year Java veteran with experience in distributed computing and wireless networking.
Appendix
C -electrical
Java Bluetooth
Development
on the PalmOS
He has an
and computer
engineering
degreePlatform
from Wayne State University in Detroit and has
Appendix
interest in
D -robotics,
BlipNet 1.1
microcomputing,
API
and electronics. He has worked in Java since JDK 1.0a, and his
research studies include distributed computing, clustering, encryption, and pervasive computing. He
Index
currently
works as an independent consultant in the Metro Detroit area.
List
of Figures
List of Tables
List of Listings
List of Sidebars
Ranjith Antony earned his bachelor of technology degree in computer engineering from the College of
Engineering, Chengannur, Kerala, India, an institute affiliated with Cochin University of Science and
Technology. He became a lecturer in the Department of Computer Engineering of the Government Model
Engineering College, an institute affiliated with Cochin University of Science and Technology. In June
1998, he joined Atinav as a software engineer. Presently, he is working as a senior technical manager and
is managing the Bluetooth-related Java products from Atinav.
About the Technical Reviewer
Andrew Stringer was educated at the Dublin Institute of Technology in computer science and software
engineering, receiving a bachelor of science degree. Andrew joined Rococo Software in 2001 as a trainer
and consultant in the field of wireless software development. Andrew has great experience in developing
and delivering courses with J2ME and also with Java APIs for Bluetooth Wireless Technology (JABWT).
Bluetooth for Java
Andrew lives in Dublin,
Ireland.
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
Apress © 2003 (352 pages)
Acknowledgments
The authors of this text describe how to develop wireless Java
I personally want applications
to thank all using
the people
whofor
helped
me of
in writing
theThis
book that you're holding. Never in a
Bluetooth
a variety
platforms.
includes
API overview
of thebe
Java
library,with
development
of and John Zukowski, both of
million years would
I havean
thought
that I would
working
Gary Cornell
Bluetooth-based
services,
of security
concerns,
and accepted my proposal way
whom are very respected
Java authors.
I'mhighlights
very grateful
that Gary
and John
more.
back in January of 2002. For that matter, I want to thank the rest of the team at Apress including Tracy
Brown, Ami Knox, Kari Brooks, and Wanshun Tam. More honor, however, goes to Tracy. Many thanks to
Andrew
Stringer from Rococo for tech reviewing this book; I never knew that I could have been wrong so
Table
of Contents
many
times.
It's good to have an expert at your disposal.
Bluetooth for Java
Introduction
Bluetooth equipment isn't cheap, so I also want to acknowledge all the great companies around the world
- Introducing Bluetooth
(literally) that
gave Ranjith and me hardware loans and technical assistance. For instance, Jeff Day and
Chapter
Bluetooth
the rest2of -the
team at1.1
3Com (including Ken Morley, Brent Nixon, and Randy Rollins) were very helpful in
Chapter
3 us
- Before
You Get Started
providing
with Bluetooth
adapters and tech support. Mahendra Tailor from TDK Systems in the UK was
Chapter
4 - Understanding
Java
BluetoothasAPI
very helpful
in providing usthe
with
equipment
well. Rococo was very kind to allow us to have an extended
Chapter
5 -period
Bluetooth
with to
J2ME
MIDP
evaluation
in order
write
the chapter on Bluetooth simulation. Thanks to Geraldine, Karl, and the
Chapter
6 -team
Creating
a Bluetooth
Print Server
with Mobiwave
JPS API
rest of the
in Ireland.
Lim Siong
Huat from
in Singapore was very helpful in allowing us to
Chapter
use their
7 protocol
- Java and
analyzer
OBEX for the security chapter. Peter Duchemin from Smart Network Devices in
Germany
verya helpful
in getting
me the inside scoop on their Micro BlueTarget. I also want to thank
Chapter
8 was
- Using
Bluetooth
Simulator
Niels-Christian
Gjerrild
from
Ericsson
in Sweden for hardware and documentation on the Ericsson BlipNet
Chapter 9 - Bluetooth Security
system.
North
of
the
border,
in
Canada,
I also
assistance from Dr. Steven Knudsen regarding the
Chapter 10 - Wireless Embedded Systems with
thereceived
Micro BlueTarget
integration
of
Jini
and
Bluetooth.
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 1
Chapter 12 - Bluetooth and Jini
This is my first book, so I definitely have to thank all the wonderful teachers at Grant, Cass Tech, and
WSU who helped me to get here. You'll never forget a good teacher, and I've had many in my lifetime. I
Appendix
B - javax.obex
want to thank
personally Mrs. Smith, Mrs. Parent, Mr. Walker, and Mrs. Cowan from Grant School. At
Appendix
C - Java
Development
on the Mr.
PalmOS
Platform
Cass Tech,
I hadBluetooth
the pleasure
to study under
Miller,
Mr. Raymond, and Mrs. Ashford. Dr. Steve Kahn
Appendix
D
BlipNet
1.1
API
was a little disappointed that I didn't finish my degree with the Mathematics Department after I joined the
Index
Emerging Scholars Program, but he deserves to be mentioned. I also want to thank Dr. Chaudhary for
List
of Figures
giving
me the opportunity to study and research with him in the Parallel and Distributed Computing Lab at
List
Wayne
of Tables
State. Very few students were eligible to work in the undergraduate research program, and I'm
grateful
to Bill Hill for allowing me to be a part of it.
List
of Listings
Appendix A - javax.bluetooth
List of Sidebars
I wouldn't be the person that I am today without the spiritual guidance of my pastors at Bethlehem Temple
Church. Many thanks to the late Bishop Jackson, the late Bishop Porter, Elder Clark, and the whole
church family.
I'm the youngest of seven children, so each one of my siblings played a role in shaping my life and career.
Thanks to Theresa, Valerie, Darlene, Barbara, Mark, and Tyrone. I definitely have to give special thanks to
Mom and Dad, because they've dealt with me for 26 years of my life. They did an excellent job raising all
seven children with college educations. Thanks to Thaddeus Johnson for being a good friend. In order to
stay smart, you have to hang around smart people.
Finally, I want to thank my wonderfully sweet wife, Schrell. She was very patient and understanding while I
wrote this book. She is truly a virtuous woman.
—Bruce Hopkins
Numerous people have provided assistance, advice, and encouragement during the preparation of this
book. Major contributors of material, ideas, insights, solutions, and explanations that have found their way
into this book include James Jose, Salman Ali, Rajesh Rabindranath, Sudhin Latheef, Vaishali Patil, and
Sajith M Nair. Besides them, my teammates at Atinav, especially George Mathew, Cipson Jose, and
Dinkar Raj, have contributed suggestions, fixed program bugs, and made imperceptible contributions too
numerous to mention. I am also grateful to Mr. Lim Siong Huat and his colleagues at Mobiwave for
extending their support by providing timely advice and necessary equipment. Without him, the chapter on
Bluetooth security would not have materialized.
Bluetooth for Java
—Ranjith Antonyby Bruce Hopkins and Ranjith Antony
ISBN:1590590783
Apress © 2003 (352 pages)
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
Introduction
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
© 2003wireless
(352 pages)
In the near future,Apress
Bluetooth
technology will be embedded into nearly every consumer electronics
The
authors
of
this text
describe
howdesktops,
to developcalculators,
wireless Java
device. Devices like mobile phones,
PDAs,
laptops,
watches, keyboards, mice,
applications using Bluetooth for a variety of platforms. This
printers, scanners, cameras, and video game consoles are just a sample of what device manufacturers
includes an API overview of the Java library, development of
will be embedding
with Bluetooth.services,
Today, Bluetooth
chipsets
can
be purchased
(in mass quantities) for $5,
Bluetooth-based
highlights of
security
concerns,
and
so it's only a matter
of time before many of your personal devices become Bluetooth enabled.
more.
With Java, you get the ability to create applications that are agnostic of their underlying hardware platform.
Table
of Contents
As you
can see, this makes Java the perfect programming language for Bluetooth! Regardless of the
Bluetooth
hardwarefororJava
OS used for your PDA, mobile phone, watch, etc., you can use the same programming
language to create your Bluetooth applications. This book is all about how to create wireless applications
Introduction
using Java
Bluetooth.
Chapter
1 - and
Introducing
Bluetooth
Chapter 2
- Bluetooth 1.1
- Before
You Get
How This
Book
IsStarted
Organized
Chapter 3
Chapter 4
- Understanding the Java Bluetooth API
Here's 5an -overview
ofwith
what's
covered
Chapter
Bluetooth
J2ME
MIDP in this book:
Chapter
6 - Creating
a Bluetooth
Print Server
with
JPS API new to Bluetooth, then this chapter is for you. In
Chapter
1: Introducing
Bluetooth:
If you're
completely
Chapter
Chapter
7 - Java
1, we
and
give
OBEX
a brief introduction to Bluetooth, with a general explanation of what you can do with
the8technology.
Chapter
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 2: Bluetooth 1.1: In this chapter, we dive right into the dirty details of the Bluetooth protocol.
Here we define the roles and relationships between the Bluetooth stack, Bluetooth profiles, and
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Bluetooth hardware. If you've seen Bluetooth terminology before, but you don't know the difference
Chapter 12 - Bluetooth and Jini
between SDP and SDAP for instance, then this chapter will help clear things up.
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Appendix A - javax.bluetooth
Appendix
B - javax.obex
Chapter
3: Before You Get Started: Chapter 3 is very appropriately named because it covers all the
Appendix
loose
C -ends
Javathat
Bluetooth
need to
Development
be addressed
on the
before
PalmOS
we show
Platform
you how to integrate Bluetooth and Java.
Appendix D - BlipNet 1.1 API
Chapter 4: Understanding the Java Bluetooth API: This chapter covers the full life cycle of a Bluetooth
application (whether you're using Java or not). This chapter also shows you how to use the
List of Figures
javax.bluetooth package of the official Java Bluetooth API (the JSR-82) in order to create
List of Tables
Bluetooth applications.
Index
List of Listings
List ofChapter
Sidebars5: Bluetooth with J2ME MIDP: The first complete example of a Java Bluetooth application is
explained in Chapter 5. Before we present the code, however, we provide a short review of the J2ME
MIDP.
Chapter 6: Creating a Bluetooth Print Server with JPS API: Now with a complete example under your
belt, things will start to get pretty exciting. In Chapter 6, we introduce you to the Java Printing API and
show you how to create a Bluetooth print server.
Chapter 7: Java and OBEX: Chapter 7 covers the foundation of the OBEX protocol and provides an
example on how to transfer files using the javax.obex package of the JSR-82.
Chapter 8: Using a Bluetooth Simulator: As you might have guessed, this chapter is all about how to
create Java applications that interact with virtual Bluetooth devices. In this chapter, the entire Bluetooth
network is simulated in software.
Chapter 9: Bluetooth Security:Chapter 9 covers the security measures provided by the Bluetooth
specification in order to make wireless applications more secure.
Chapter 10: Wireless Embedded Systems with the Micro BlueTarget: The primary focus of Chapter 10
is the Micro BlueTarget by Smart Network Devices. In this chapter, we explore the possibilities of
creating applications with a fully functional computer that fits in your hand and includes an
implementation of the JSR-82.
Chapter 11: Enterprise Bluetooth Applications with the Ericsson BlipNet: In Chapter 11, we introduce
Bluetooth for Java
you to enterprise
Bluetooth applications and show you how to construct them using Java and the
ISBN:1590590783
by Bruce Hopkins and Ranjith Antony
Ericsson BlipNet.
Apress © 2003 (352 pages)
Chapter 12: Bluetooth
and
In the
final chapter
the book,
we provide
an overview of Jini network
The authors
of Jini:
this text
describe
how to of
develop
wireless
Java
applications
Bluetooth
for aJini
variety
of platforms.
This
technology and
describeusing
how to
implement
and Bluetooth
together.
includes an API overview of the Java library, development of
services, highlights
of security
concerns,
and
Appendix A: Bluetooth-based
javax.bluetooth:Appendix
A is a handy
reference
that contains
all the method signatures
more.
of the javax.bluetooth API.
Appendix B: javax.obex: Appendix B is a handy reference that contains all the method signatures of
thejavax.obex API.
Table of Contents
Bluetooth for Java
Introduction
Appendix C: Java Bluetooth Development on the PalmOS Platform: Appendix C provides a quick
Chapter
1 - Introducing
overview
of how to Bluetooth
get started creating Java Bluetooth applications on the Palm OS platform.
Chapter 2
- Bluetooth 1.1
Appendix
D: BlipNet
API: Appendix D contains full descriptions of the classes, exceptions, and
Chapter
3 - Before
You Get1.1
Started
interfaces
that comprise
BlipNet
API.API
This appendix will be really useful to have on hand when
Chapter
4 - Understanding
thethe
Java
Bluetooth
developing
BlipNet applications.
- Bluetooth with J2ME MIDP
Chapter 5
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
Intended Audience
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
So who are you?Apress
This book
really
has two audiences. If you're a Java developer, then this book assumes
© 2003
(352 pages)
that you're an intermediate
Java
developer
with little
experience
with
Bluetooth. You'll get the most
The authors of this text describe
how or
to no
develop
wireless
Java
out of this book ifapplications
you've written
a
few
Java
classes
on
your
own
(especially
using Bluetooth for a variety of platforms. This J2ME applications).
includes an API overview of the Java library, development of
Bluetooth-based
services,
highlights
of security
andChapter 2. If you've never used
If you're a Bluetooth
developer, then
this book
becomes
usefulconcerns,
to you after
more.
Java before, then we'd suggest that you read the first few chapters of a J2ME book before you read this
book.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
The Code
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
The source codeApress
for this©book
is available
at http://www.apress.com in the Downloads section. The
2003 (352
pages)
book's companion
Web
site,
http://www.javabluetooth.com,
also
contains the source code, as
The authors of this text describe how to develop wireless
Java
well as other useful
resources
such
as
a
list
of
recommended
Bluetooth
hardware
for running the
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
examples.
Bluetooth-based services, highlights of security concerns, and
more.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
for Java
Chapter Bluetooth
1: Introducing
Bluetooth
ISBN:1590590783
by Bruce Hopkins and Ranjith Antony
Apress ©is
2003
(352 pages)
Simply stated, Bluetooth
a wireless
communication protocol. As such, you would use Bluetooth to
The
authors
of
this Bluetooth-capable
text describe how todevices.
develop In
wireless
Java Bluetooth is like any other
communicate to two or more other
this sense,
applications using Bluetooth for a variety of platforms. This
communication protocol that you may use every day like HTTP, FTP, SMTP, or IMAP. Bluetooth is also
includes an API overview of the Java library, development of
like these protocols
in that it has aservices,
client-server
architecture.
Inconcerns,
Bluetooth,and
the one who initiates the
Bluetooth-based
highlights
of security
connection (the client)
more. is the master, and the one who receives the connection (the server) is the slave.
The purpose of this chapter is to give you an introduction to Bluetooth. We'll briefly compare it with
Table
of Contents
competing
technologies like Infrared and 802.11b and explain where Bluetooth fills the gaps that these
Bluetooth
other technologies
for Java
leave open. Next, we'll show you what Bluetooth can do and where it is currently used
in applications today, just in case you're unfamiliar with the capabilities of the technology. Finally, we'll
Introduction
wrap up1 this
chapter with
a few scenarios for how Bluetooth will be used in the near future.
Chapter
- Introducing
Bluetooth
Chapter 2
- Bluetooth 1.1
- Before
YouInfrared
Get Started
Bluetooth
vs.
Chapter 3
Chapter 4
- Understanding the Java Bluetooth API
Of course,
Chapter
5 -wireless
Bluetoothcommunication
with J2ME MIDPbetween two computers is not new. PDAs have been able to do that
for years
infrared
technology.
drawback
infrared is that the devices involved must be a few
Chapter
6 using
- Creating
a Bluetooth
PrintOne
Server
with JPStoAPI
feet apart,
importantly, the infrared transceivers must see each other "eye to eye." If either of
Chapter
7 -and
Javamost
and OBEX
those conditions
are not met, then the transmission will fail. Bluetooth overcomes the first limitation by
- Using a Bluetooth Simulator
having a nominal range of about 10 meters (30 feet). Bluetooth overcomes the second limitation because
Chapter 9 - Bluetooth Security
it works like a radio, so transmissions are omnidirectional. Consequently, there are no line-of-sight issues
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
when communication occurs between two Bluetooth devices.
Chapter 8
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth
for Java
Bluetooth vs.
802.11b
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
If you've heard ofApress
Bluetooth
before,
then you've certainly heard of 802.11b (the wireless LAN protocol),
© 2003
(352 pages)
another wireless The
communication
protocol.
Bluetooth
802.11b
were created
to accomplish two
authors of this text describe
how and
to develop
wireless
Java
different goals, although
both
technologies
operate
in
the
same
frequency
band:
2.4 GHz.
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
services,
highlights
of security
concerns,
Note Having Bluetooth-based
both technologies
operate
at the same
frequency
rangeand
does not mean they'll interfere
more.
when placed in range of each other, according to a Forrester Research study conducted in
2001. Go to http://www.forrester.com/ for details on that report.
Table of Contents
The goal of wireless LAN (802.11b) is to connect two relatively large devices that have lots of power at
Bluetooth
for Java
high speeds.
Typically, this technology is used to connect two laptops within 300 feet at 11 Mb/s. This
Introduction
technology is also useful for network administrators who want to extend their LAN to places where it is
Chapter
1 - Introducing
Bluetooth to run cables.
either expensive
or inconvenient
Chapter 2 - Bluetooth 1.1
On the 3other
hand,You
Bluetooth
is intended to connect smaller devices like PDAs and mobile phones within a
Chapter
- Before
Get Started
range of
feet at a rate of
1 Mb/s.
Slower data
Chapter
4 30
- Understanding
the
Java Bluetooth
API rates and shorter ranges allow Bluetooth to be a lowpower wireless
technology.
Compared
Chapter
5 - Bluetooth
with J2ME
MIDP to 802.11b devices, some Bluetooth devices can easily consume
500 times -less
power, which can make a huge difference in the battery life of many mobile devices.
Creating a Bluetooth Print Server with JPS API
Chapter 6
Chapter
7 is
- Java
OBEX to be used as a cable replacement technology. If you have multiple peripherals
Bluetooth
alsoand
intended
Chapter
8 - to
Using
Bluetooth using
Simulator
connected
youracomputer
RS-232 or USB, then Bluetooth is the ideal solution if you want to use
Chapter
9 - Bluetooth
Security
those devices
wirelessly.
It's almost impossible to connect peripherals to your computer using 802.11b
Chapter
10 - (well,
Wireless
Embedded
Systems
with the even
Micro has
BlueTarget
technology
except
for printers).
Bluetooth
a built-in capability for wireless audio
Chapter
11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
communication.
Chapter 12 - Bluetooth and Jini
Can either
replace the other? Hardly. Bluetooth will never replace 802.11b because it's bad at
Appendix
A -technology
javax.bluetooth
handling the following:
Appendix B - javax.obex
Appendix
C -file
Java
Bluetooth
Development
Large
transfers
between
deviceson the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index Long-range communication (only Class 1 Bluetooth devices have a range of 300 feet)
List of Figures
CROSSREFERENCE
List of Tables
List of Listings
See "Bluetooth Device Power Classes" in Chapter 2 for details about power
classes.
List
Sidebars
Onofthe
other hand, 802.11b will never replace Bluetooth because
802.11b can't be used to communicate to peripherals.
802.11b requires too much power for communication.
802.11b is overkill for small data transfers.
802.11b wasn't designed for voice communication.
In the wireless communication arena, there is no technology that is best suited for every possible
application. Either Bluetooth or 802.11b can be used for wireless communication between computers.
Both have their place in the market and can perform in their niches well. Newer wireless LAN protocols
like 802.11a and 802.11g will further clear the distinction between Bluetooth and wireless LAN because
they extend 802.11b's bandwidth limitation to 54 Mb/s.
Bluetooth for
Java
Bluetooth Devices
on
the Market Today
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
Now, let's take a Apress
look at©Bluetooth
devices that you can get at any consumer electronics store today. We'll
2003 (352 pages)
highlight the problems
that
Bluetooth
solves
and how
give to
some
scenarios
forJava
using this technology. If you're
The authors of this text
describe
develop
wireless
already familiar with
common
usage
scenarios
of
Bluetooth
devices,
then
applications using Bluetooth for a variety of platforms. This feel free to skip this section.
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
Wireless Data Transfer: PDA to Phone
Almost everyone owns a mobile phone nowadays. These devices are very convenient, compact, and cute
Table
ofatContents
(well,
least some of them). However, they suffer from two major limitations:
Bluetooth for Java
Mobile phones have limited memory for phone book entries.
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Data entry on mobile phones can be cumbersome.
Chapter
3 been
- Before
Youbefore.
Get Started
We've all
there
Entering data on a mobile phone is very tedious because you're dealing with
Chapter
a nine-button
4 - Understanding
keypad to type
thealphanumeric
Java Bluetoothtext.
API Also, mobile phones don't have a lot of memory for
storage,
you're limited
onlyMIDP
50 or 100 entries. On top of that, you'll also need to truncate some
Chapter
5 so- Bluetooth
with to
J2ME
names6when
adding aphone
entries,
"Auntwith
Clarissa
Johnson" becomes "Ant Clrssa Jnsn."
Chapter
- Creating
Bluetooth
Printso
Server
JPS API
Chapter 7
- Java and OBEX
If you own a PDA, then you probably agree that PDAs are also useful devices. They can store thousands
Chapter 8 - Using a Bluetooth Simulator
of contact entries, and they are a lot better for entering data compared to mobile phones. Since you can't
Chapter 9 - Bluetooth Security
store your entire contact list on your mobile phone, you probably have it stored on your PDA.
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Unfortunately, it's a little inconvenient to look up a phone number on the PDA and then manually dial the
Chapter
Enterprise
number11on- the
mobileBluetooth
phone. Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
With a Bluetooth-enabled
Appendix
A - javax.bluetoothPDA and a Bluetooth-enabled mobile phone, you can keep your entire contact
list on the
where it's far more convenient. Don't even bother to store phone numbers on your phone.
Appendix
B -PDA
javax.obex
Whenever
ready toDevelopment
dial a number,
youPalmOS
just look
up the number on the PDA and send the phone
Appendix
C -you
Javaare
Bluetooth
on the
Platform
number Dover
to the1.1
phone;
Appendix
- BlipNet
API no wires, no hassle. Figure 1-1 is a picture of one of HP's advanced Bluetoothenabled PDAs.
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Figure 1-1: The short antennae on HP iPAQ 5400 series Pocket PC allows it to communicate via
Bluetooth and 802.11b. For added security, this model also includes a fingerprint reader.
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
ConnectionTheSharing:
Laptop to Phone
authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
If you're a programmer
and you have a laptop, you know how cumbersome it is to get a dial-up Internet
includes an API overview of the Java library, development of
connection on your
mobile phone.services,
You may
have anofInternet-ready
phone,
Bluetooth-based
highlights
security concerns,
andbut you may not have the right
cable. Maybe youmore.
have the right cable (which isn't cheap), but you need additional software to establish
the dial-up connection. Sometimes, you need to connect two cables together to accomplish this feat.
Bluetooth eliminates all the hassle from this scenario by creating a standardized method for wireless dialTable of Contents
up networking. You can even keep your wireless phone at your hip or in your purse while you surf the Web
Bluetooth
for JavaThe same applies for PCs or PDAs that want to use your phone to connect to the Internet.
on your laptop.
Introduction
This is really convenient whenever your broadband connections at home go down for servicing. You can
Chapter
- Introducing
Bluetooth
simply 1place
your wireless
phone in the vicinity of your PC and that's it, you're connected.
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Personal
Networks: PC to PC
- Understanding the Java Bluetooth API
Chapter 4
Chapter
5 is
- Bluetooth
with J2ME MIDP
Bluetooth
great for connecting
two PCs together at a moderate speed. If you want higher speeds or if
Chapter
6
Creating
a
Bluetooth
Print you're
Server better
with JPS
you need to transfer large
files, then
off API
using Wireless LAN technology. On the other hand,
Chapter
7 is
- Java
OBEX
Bluetooth
goodand
at creating
small, personal networks. So this is a great technology if you're having an
Chapter
impromptu
8 - meeting
Using a Bluetooth
with coworkers.
Simulator
Bluetooth also has the added capability to discover new devices when
they enter
network.
Chapter
9 -your
Bluetooth
Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Cable Replacement: PC to Peripherals
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
You canAimagine
Bluetooth as functioning like any other protocol to connect to your peripherals, such as
Appendix
- javax.bluetooth
serial (RS-232),
parallel, USB, or Firewire. In the near future, your personal computer will be equipped
Appendix
B - javax.obex
with a Bluetooth
in the
same manner
that
it currently
features a serial and USB port.
Appendix
C - Java "port"
Bluetooth
Development
on the
PalmOS
Platform
Appendix D - BlipNet 1.1 API
You can use Bluetooth to connect to your peripherals wirelessly and effortlessly. Have you ever been to a
remote location with a laptop and wanted to use a printer to print out some files? If you don't have the right
List of Figures
printer driver or the right cable, then you'll need to give your file to someone who does have it. If that
List
of Tables
person
doesn't have the right program to read your file, then you're out of luck; no printing for you. If you
List
of
had aListings
Bluetooth laptop and that printer was a Bluetooth printer (regardless of the manufacturer), then
List
of Sidebars
you'd
have no problem. With Bluetooth, you can ask the printer for the right driver if you don't have it, and
then you can print your file with no problem.
Index
The Power User
So what if you're a power user? You most likely have a PDA, a wireless phone, a printer or two, a scanner,
an MP3 player, a digital camera, and a DV camera. The back of your computer probably looks like a rat's
nest of wires and cables. Some devices you may leave disconnected until you really, really need them.
Bluetooth solves all this by allowing you to have virtually an unlimited number of peripherals wirelessly
connected to your computer. The only limitation is that you can only have seven active connections at the
same time. That should be fine because it would be quite rare for you to print, scan, upload pictures, and
sync your PDA all at the same time.
Interoperability: Any Device to Any Device
In the previous scenario, your non-Bluetooth-enabled devices are definitely not interoperable. In other
words, if you want to send a picture from the camera to the PDA, then you'll need to use the computer to
interconnect them. The same also goes if you want to scan a document and send it to the printer (i.e., to
act like a copier) or send it to the PDA; you'll always need your PC to be the "man in the middle." Of
course, you can buy a cable or two to do some of those tasks, but those cables are rare and expensive.
Bluetooth solves all this by allowing your devices to communicate among themselves with no hassle and
with no cables. It's essentially the universal cable!
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
Bluetooth in
the© 2003
Small
Office or Home Office
Apress
(352 pages)
The authors of this text describe how to develop wireless Java
In the small officeapplications
setting, how
do you share peripherals like a printer among users? Let's say you have a
using Bluetooth for a variety of platforms. This
$300 printer that includes
you wantantwo
users
on your
network
to share.
Your cheapest
option is to buy a print
API overview
of the
Java library,
development
of
server—but that'sBluetooth-based
another $300! You
services,
mighthighlights
as well buy
of security
anotherconcerns,
printer for
and
that kind of money. With
Bluetooth, if bothmore.
your users are in range, no print server is needed because both users can connect to the
printer as if it were a local printer. For that matter, the printer should be able to print for every Bluetooth
user within range; but remember that it can only handle seven active connections at the same time.
Table of Contents
Bluetooth for Java
Bluetooth for Voice Applications
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 5
- Bluetooth with J2ME MIDP
Now, Bluetooth is great at transferring data wirelessly, but it also has the capability to transmit voice and
Chapter 2 - Bluetooth 1.1
sound as well. So if you had a Bluetooth headset, you could use the same headset to answer calls on your
Chapter 3 - Before You Get Started
Bluetooth-enabled wireless phone as well as answer calls on your Bluetooth-enabled home phone. You
Chapter 4 - Understanding the Java Bluetooth API
could also use the same headset to listen to your Bluetooth-enabled portable radio.
Chapter
6 can
- Creating
a Bluetooth
Print
API driving and you receive a call on your wireless
Bluetooth
also be
enabled in
yourServer
car sowith
thatJPS
if you're
Chapter
phone,7you- can
Java simply
and OBEX
transfer the call to the hands-free system built right into the car. Your phone stays
on your8hip,
or in your
briefcase.
You can also use the same technology to initiate a call in your car without
Chapter
- Using
a Bluetooth
Simulator
touching
phone at
all. In either case, if you've arrived at your destination and you want to continue the
Chapter
9 your
- Bluetooth
Security
conversation,
you just
transfer the
call back
phone.
Chapter
10 - Wireless
Embedded
Systems
with to
thethe
Micro
BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Bluetooth for Wireless Gaming
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Of course,
can use Bluetooth for wireless gaming. It's always a hassle when you want to connect two
Appendix
B -you
javax.obex
handheld
systems
and playon
against
a friend.
Most cables were about 6 feet long, so if both
Appendix
C video
- Javagame
Bluetooth
Development
the PalmOS
Platform
players were
on a school
Appendix
D - BlipNet
1.1 APIbus, they needed to sit right next to each other to play. With Bluetooth, you just
have to come within range of your opponent to play.
Index
List
of Figures
Okay,
we're grownups now. But what do you do if you're in a boring meeting and you have some time to
List
of With
Tables
kill?
Bluetooth, you and your equally bored colleague can both get out your PDAs and play a game of
List
of Listings
checkers.
PDAs are business tools, so no one will ever know if you are taking down notes or getting
List
of Sidebars
double
jumped. Figure 1-2 shows a Bluetooth-enabled mobile gaming device that could revolutionize the
portable gaming industry: the Nokia N-Gage.
Figure 1-2: The Bluetooth-enabled Nokia N-Gage wireless gaming system
for Java
Devices of Bluetooth
the Future
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
So, what kind of devices,
Apress © applications,
2003 (352 pages)or innovations can we expect to see in the future that involve
Bluetooth? Well, The
hereauthors
are justofathis
fewtext
thatdescribe
we can how
thinktoof:
develop wireless Java
applications using Bluetooth for a variety of platforms. This
Bluetooth locator
system
includes
an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
Personalizedmore.
family car
The new arcade: a restaurant lobby
Table of Contents
The following
sections describe these in more detail.
Bluetooth
for Java
Introduction
- Introducing
Bluetooth
Bluetooth
Locator
System
Chapter 1
Chapter 2
- Bluetooth 1.1
Let's start
with aYou
Bluetooth-enabled
home, which means that wherever you go in your home, you are
Chapter
3 -off
Before
Get Started
within range
of the wirelessthe
network.
With a Bluetooth-enabled
home, you have the ultimate locator
Chapter
4 - Understanding
Java Bluetooth
API
system.5 All- your
Bluetooth-enabled
devices can never be misplaced if they are within the bounds of your
Chapter
Bluetooth
with J2ME MIDP
home. If an
item ever gets lost, all you need to do is go to your PC and start up the Bluetooth locator
- Creating a Bluetooth Print Server with JPS API
system program. For basic systems, you tell the program what device you are looking for, and the device
Chapter 7 - Java and OBEX
will beep until it is found. For advanced systems, the Bluetooth locator system will display a map of your
Chapter 8 - Using a Bluetooth Simulator
house and show you which room has your lost item. This solution is ideal for people who always misplace
Chapter 9 - Bluetooth Security
small but essential items like PDAs, wireless phones, keys, TV remotes, watches, and baby pacifiers!
Chapter 6
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Personalized Family Car
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
In this example, let's start off with a Bluetooth-enabled car. With a Bluetooth-enabled car, all you need to
do is to set the mirrors, seats, and radio stations just once and store your preferences on a BluetoothAppendix
- Javathat
Bluetooth
Development
onthe
the time,
PalmOS
enabledCdevice
you carry
with you all
likePlatform
a wireless phone, PDA, or a watch. It wouldn't
Appendix
D
BlipNet
1.1
API
matter if someone else used your car, because all your preferences are stored on the device you keep
Index
with you. After someone uses your car, all you need to do is upload your preferences from your BluetoothList
of Figures
enabled
device (like your watch—see Figure 1-3) and be on your merry way.
Appendix B - javax.obex
List of Tables
List of Listings
List of Sidebars
Figure 1-3: Although the Fossil Wrist PDA doesn't contain any Bluetooth hardware, it does come
preloaded with a Bluetooth-enabled OS— the Palm OS 4.1. Palm OS is a registered trademark of
Palm, Inc.
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
The New Arcade:
A Restaurant Lobby
Apress © 2003 (352 pages)
ISBN:1590590783
The sometime
authors of in
this
describe
develop
wireless
Finally, let's say that
thetext
near
future,how
youto(and
several
otherJava
people) are waiting for a seat at a
applications using Bluetooth for a variety of platforms. This
restaurant. While you are waiting for your table, the hostess gives you a little gaming device to help you kill
includes an API overview of the Java library, development of
time. This Bluetooth-enabled
device
not only
lets youofplay
games
againstand
the computer, but you can also
Bluetooth-based
services,
highlights
security
concerns,
play games with other
more. people in the lobby! When your table is ready, your game unit vibrates
automatically, so the hostess doesn't even need to call you. When you turn your device in to the hostess,
your score is automatically uploaded to the high scores list. If your score is good enough, you may even
Table
Contents
win aoffree
meal.
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Summary
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
Bluetooth is a great
technology
forpages)
wireless connections between power-conservative computer devices. It
Apress
© 2003 (352
is also a great cable
replacement
technology
forhow
PCstoand
laptops.
It canJava
function as a universal connector
The authors of this text describe
develop
wireless
between your peripherals
and
devices,
and
you
may
never
again
need
a
cable
(some of which can be
applications using Bluetooth for a variety of platforms. This
includes
andevices
API overview
of the Java library, development of
expensive) to connect
your
together.
Bluetooth-based services, highlights of security concerns, and
more.
In the next chapter,
we'll dig right in to the Bluetooth protocol. If you're new to Bluetooth, this will be your
first introduction to a lot of new terminology. We'll explain to you the components of the Bluetooth stack
and the purpose of Bluetooth profiles. When you create your wireless applications, you'll interact with the
Table of Contents
stack and profiles to send and receive data.
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
for Java
Chapter Bluetooth
2: Bluetooth
1.1
by Bruce Hopkins and Ranjith Antony
Overview
ISBN:1590590783
Apress © 2003 (352 pages)
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
The main focus of
includes
this chapter
an APIisoverview
to describe
of the
theJava
inner
library,
workings
development
of Bluetooth.
of
The most current revision of
Bluetooth-based
highlights
of security
concerns,
and
the protocol is version
1.1. Almostservices,
every device
on the
market today
is compliant
with Bluetooth version
more.
1.1, although you might be able to find some devices that use the 1.0B version of Bluetooth. The
differences between Bluetooth 1.0B and 1.1 are beyond the scope of this book. The differences are
minimal,
and they really don't apply to Java programmers.
Table
of Contents
Bluetooth for Java
What can you expect for future versions of Bluetooth like 1.2 and 2.0? Whenever the Bluetooth SIG (the
group of companies that developed the Bluetooth spec) plans to release later revisions of the spec, you
Chapter
1 - some
Introducing
can expect
thingsBluetooth
like higher speeds, more profiles, and backward compatibility with 1.1. We
Chapter
2 expect
- Bluetooth
1.1 versions to try to compete with 802.11 speeds, but you might see data rates of
wouldn't
the newer
Chapter
- Before
You Bluetooth's
Get Started niche is as a low-power wireless communication protocol, so don't
4, 8, or3even
12 Mb/s.
Chapter
- Understanding
Java Bluetooth
API
expect 4Bluetooth
2.0 to be the
a power
hog.
Introduction
Chapter 5
- Bluetooth with J2ME MIDP
CROSSSeeChapter
1 for with
a discussion
Chapter
6 - Creating a Bluetooth
Print Server
JPS API of Bluetooth versus 802.11b.
REFERENCE
Chapter
7 - Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
This chapter
is all about Bluetooth. We'll give you brief history on how it began and how it got its name.
Chapter
9 -show
Bluetooth
Security
Next, we'll
you the
radio spectrum and where Bluetooth fits in with devices that you probably already
Chapter
10
Wireless
Embedded
Systems the
withanatomy
the MicroofBlueTarget
know about. Afterwards, we'll describe
a Bluetooth-enabled device by giving a description
Chapter
11 - Enterprise
Applications
the Ericsson
BlipNetFor the remainder of this book, when
of Bluetooth
hardware,Bluetooth
the Bluetooth
stack, with
and Bluetooth
profiles.
Chapter
12
Bluetooth
and
Jini
we refer to Bluetooth, we are referring to the 1.1 version of the spec. Now, let's dig in to Bluetooth!
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth
for Java
A Brief History
of Bluetooth
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
Bluetooth got its name
Apressfrom
© 2003King
(352 Harald
pages) Blätand (Bluetooth) of Denmark. His most notable
accomplishment The
wasauthors
that he of
united
Denmark
and
Norway
under
Christianity
this text
describe
how
to develop
wireless
Java in the 10th century. In 1994,
Ericsson conducted
the
first
research
studies
of
a
wireless
technology
to
applications using Bluetooth for a variety of platforms. Thislink mobile phones and
includes
an1997,
API overview
the Java
library,
development
of
accessories. Years
later in
Ericssonofformed
the
Bluetooth
Special Interest
Group (Bluetooth SIG) so
Bluetooth-based
services,
highlights
of securityAt
concerns,
and
that other companies
could use and
promote
the technology.
that time,
the Bluetooth SIG consisted of
more.
the following promoter companies:
Ericsson
Table of Contents
Bluetooth
IBM for Java
Introduction
Intel
Chapter
1 - Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Nokia
Chapter
4 - Understanding the Java Bluetooth API
Toshiba
Chapter 5
- Bluetooth with J2ME MIDP
Later on,
1999 after
the 1.0 specification
Chapter
6 in
- Creating
a Bluetooth
Print Server was
withreleased,
JPS API the Bluetooth SIG added four more members:
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
3Com
Chapter
9 - Bluetooth Security
Agere
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Microsoft
Chapter
11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Motorola
Appendix A - javax.bluetooth
Appendix
B - Bluetooth
javax.obexSIG has well over 2,000 members that are all interested in promoting and improving
Today, the
Appendix
C - Java
Bluetooth Development on the PalmOS Platform
the Bluetooth
standard.
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
The Radio Spectrum
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
Wireless communication
computers is either in the form of light or radio signals. Infrared
Apress © between
2003 (352 pages)
technology is theThe
common
way
to
conduct
short range
communications
and obviously uses light.
authors of this text describe
how towireless
develop wireless
Java
Conversely, Bluetooth
technology
uses
radio
signals.
Table
2-1
gives
a
list
of
common
everyday items that
applications using Bluetooth for a variety of platforms. This
includes
an API overviewAs
of the
development
of
rely on radio signals
for communication.
you Java
can library,
see, Bluetooth,
cordless
phones, 802.11b, and
highlights
security concerns,
and concept if you are new to all
802.11g fall in theBluetooth-based
2.4 GHz range.services,
Hopefully,
this willofdemystify
the Bluetooth
more.
this; it's just a radio.
Table
Common Radio Frequencies
Table
of 2-1:
Contents
Bluetooth for Java
ITEM
Introduction
Chapter
AM radio
1 - Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Garage door openers
Baby 4monitors
Chapter
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
TV channels 2–6
FREQUENCY RANGE
535 kHz-1.6 MHz
40 MHz
49 MHz
54 MHz-88 MHz
FM radio
Chapter
7 - Java and OBEX
88 MHz-108 MHz
Chapter 8
174 MHz-216 MHz
- Using a Bluetooth Simulator
TV channels
7–13
Chapter 9
- Bluetooth Security
TV channels
14–83Embedded Systems with the Micro BlueTarget
512 MHz-806 MHz
Chapter
10 - Wireless
Chapter
11cellular
- Enterprise
BlipNet
CDMA
phoneBluetooth Applications with the Ericsson824
MHz-894 MHz
Chapter 12 - Bluetooth and Jini
GSM cellular
phone
Appendix
A - javax.bluetooth
880 MHz-960 MHz
Appendix
B -phones
javax.obex
Cordless
900 MHz
Appendix C - Java Bluetooth Development on the PalmOS Platform
GlobalDPositioning
System
Appendix
- BlipNet 1.1
API
1.227 GHz-1.575 GHz
Index
PCS cellular phone
List of Figures
1.85 GHz-1.99 GHz
802.11b
2.4 GHz-2.483 GHz
List802.11g
of Listings
2.4 GHz-2.483 GHz
List of Tables
List of Sidebars
Bluetooth
2.4 GHz-2.483 GHz
Cordless phones
2.4 GHz
802.11a
5.15–5.35 GHz
Bluetooth Devices
So, if a Bluetooth device is just a radio, then what do these radios look like? Well, Figures 2-1,2-2, and 2-3
are just a sample of devices that are Bluetooth radios. Some of these items are used in development kits,
while others are meant to be used by consumers.
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Figure
The 3COM
USB Bluetooth module
Chapter
2 - 2-1:
Bluetooth
1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Figure 2-2: The CSR BlueCore 1. This single-chip solution includes a microprocessor, RAM, I/O
controller, and Bluetooth implementation in a single package! This is most likely the smallest radio
List of Figures
that you've ever seen.
Index
List of Tables
List of Listings
List of Sidebars
Figure 2-3: The Palm SD Bluetooth card for Palm OS 4 devices. Palm OS is a registered trademark
of Palm, Inc.
The examples in this book will use a variety of Bluetooth devices from multiple vendors. The example in
Chapter 8, however, uses no Bluetooth devices at all! In that example, we simulate the entire Bluetooth
network in software using the Rococo Impronto Simulator.
Point-to-Point and Multipoint
One factor that distinguishes various Bluetooth devices is their connection capabilities. If a Bluetooth
Bluetooth for Java
device can only support point-to-point communication, then it can only communicate to a single Bluetooth
ISBN:1590590783
Bruce Hopkins and Ranjith Antony
device at a time. by
Figure
2-4 demonstrates point-to-point communication in Bluetooth.
Apress © 2003 (352 pages)
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
Table of Contents
Bluetooth for Java
Introduction
Chapter
Figure
1 - 2-4:
Introducing
You can
Bluetooth
only connect to one Bluetooth device at a time if you have hardware that only
supports
point-to-point
Chapter
2 - Bluetooth
1.1 communication.
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Now, point-to-point
communication isn't necessarily a bad thing. If you have a Bluetooth phone, you really
Chapter
5 -one
Bluetooth
with J2ME
MIDP
only need
connection
to your
Bluetooth phone. Frankly, it doesn't make sense to have multiple
Chapter
6
Creating
a
Bluetooth
Print phone
Server while
with JPS
headsets be able to connect to your
youAPI
are using it.
Chapter 7
- Java and OBEX
On the 8other
hand,
a multipoint
device is able to communicate with up to seven other devices at the same
Chapter
- Using
a Bluetooth
Simulator
time.
Figure
2-5
is
a
diagram
of
a
multipoint device communicating to other devices within range using
Chapter 9 - Bluetooth Security
Bluetooth
technology.
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Figure 2-5: You can connect to up to seven Bluetooth devices at a time if you have multipoint-capable
hardware.
Bluetooth Device Power Classes
Bluetooth hardware devices are broken up into three power classes. Table 2-2 describes the device
classes and their capabilities.
Table 2-2: Bluetooth Device Power Classes
CLASS
POWER RATING
RANGE
Class 1
100 mW
100 meters
Class 2
2.5 mW
20 meters
Class 3
1 mW
10 meters
So as we stated in Chapter 1, Bluetooth devices are not limited to 10 meters in range.
Bluetooth
Java
CROSS
Seefor
"Bluetooth
vs. 802.11b" in Chapter 1 for details on the initial discussion of
ISBN:1590590783
by BruceBluetooth's
Hopkins and
Ranjith Antony
REFERENCE
range.
Apress © 2003 (352 pages)
How can you determine
a Bluetooth
device's
power
and thereby
The authors
of this text
describe
howclass,
to develop
wirelessknow
Java its range? The power class is
rarely printed on the
unit,
so
here's
a
hint
if
you're
trying
to
distinguish
the
applications using Bluetooth for a variety of platforms. Thispower class of a device that
includes
the Javaby
library,
development
you've never seen
before.an
If API
thatoverview
device isof
powered
batteries,
or if it fitsofin your hand (like a wireless
Bluetooth-based
services,
of security
and
phone or a headset),
then it is most
likely ahighlights
Class 2 or
3 device.concerns,
If the Bluetooth
device is built right into the
more.
hardware of another unit, and that unit is plugged into AC power, then it is most likely a Class 1 device.
Don't worry about Bluetooth device classes too much; just be aware that Bluetooth can communicate at
greater distances than 10 meters.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth
for Java Stack
The Bluetooth
Protocol
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
Your computer isApress
a pretty
powerful
device. It has a processor, memory, bus, hard drive, and other neat
© 2003
(352 pages)
things. The unfortunate
thing
is
that
the computer
doesn't
have the
abilityJava
to use peripherals by itself.
The authors of this text
describe how
to develop
wireless
Common peripherals
like
CD/DVD
drives,
graphic
displays,
mice,
keyboards,
modems, printers, and
applications using Bluetooth for a variety of platforms. This
API computer
overview of
the Java
library,
development
scanners all needincludes
drivers.an
Your
needs
a driver
to instruct
it howofto use a peripheral. By itself, the
highlights
of with
security
concerns,
and
computer has noBluetooth-based
idea how to printservices,
to a printer
or scan
a scanner.
The
computer is pretty powerful, but
more.
also pretty helpless. The device driver is the controlling agent that helps the computer to communicate
with its peripherals.
Table of Contents
The Bluetooth stack and Bluetooth hardware have a similar relationship. The Bluetooth stack is a
controlling agent (it could be software, firmware, hardware, or a combination of all three) that implements
Introduction
the Bluetooth protocol and also allows you to control your Bluetooth device programmatically. The
Chapter 1 - Introducing Bluetooth
Bluetooth stack allows you to do these two things:
Bluetooth for Java
Chapter 2
- Bluetooth 1.1
Chapter
3 - Before You
Started
Communicate
withGet
other
Bluetooth devices
Chapter 4 - Understanding the Java Bluetooth API
Control
your ownwith
Bluetooth
device
Chapter
5 - Bluetooth
J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
So, if you're
familiar with the HTTP protocol stack and how it works, then you can relate to the Bluetooth
Chapter
7 stack.
- JavaAand
OBEX
protocol
Web
browser uses an HTTP protocol stack so that it can receive Web content like HTML
Chapter
- Using
a Bluetooth
pages, 8images,
files,
and bestSimulator
of all, Java applets. A Web server also uses an HTTP protocol stack to
Chapter
9 Web
- Bluetooth
send out
contentSecurity
to Web browsers over the network. So, like the HTTP protocol stack, a Bluetooth
Chapter
10stack
- Wireless
Embedded
Systems
with
Micro BlueTarget
protocol
will allow
Bluetooth
clients
andthe
servers
to send and receive data over a wireless network.
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
So how12
do- the
Bluetooth
and the Bluetooth stack work together? What is their relationship? Well, a
Chapter
Bluetooth
and device
Jini
Bluetooth
without a stack can be compared to a computer without an operating system. More
Appendix
A device
- javax.bluetooth
specifically, it's like a computer peripheral without a driver. Figure 2-6 illustrates this concept.
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Figure 2-6: A) The computer may be attached to its peripherals, but it can't control them without a
driver. B) The computer may be attached to a Bluetooth device, but it can't control it without a stack.
So, in order to communicate with the Bluetooth protocol and to control a Bluetooth radio, your computer
uses a Bluetooth stack. Now, let's break down the Bluetooth stack into its individual components and see
how they work. Each component of the stack is called a layer.
Layers of the Protocol Stack
For application developers, the Bluetooth protocol can be broken up into two main items: layers and
profiles. All the layers of the Bluetooth protocol form the protocol stack. Figure 2-7 shows how the
following layers of the Bluetooth protocol "stack up":
Host Controller Interface (HCI)
Logical Link Control and Adaptation Protocol (L2CAP)
Service Discovery Protocol (SDP)
RFCOMM
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
Telephony Control Protocol Specification (TCS-BIN)
ISBN:1590590783
The authors
this text describe how to develop wireless Java
Wireless Access
Protocolof(WAP)
applications using Bluetooth for a variety of platforms. This
includes
an API overview of the Java library, development of
Object Exchange
(OBEX)
Bluetooth-based services, highlights of security concerns, and
more. Encapsulation Protocol (BNEP)
Bluetooth Network
Human Interface Device Protocol (HID)
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter
10 - 2-7:
Wireless
the Micro BlueTarget
Figure
TheEmbedded
Bluetooth Systems
protocol with
stack
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Note
if you're
familiar
with the Java Collection Framework, then you've heard of
Chapter
12 Now,
- Bluetooth
and
Jini
Please erase that idea from your mind completely, or you'll be thoroughly
Appendix A java.util.Stack.
- javax.bluetooth
here. Bluetooth uses some terms like stack and profile, which unfortunately are used
Appendix B confused
- javax.obex
in Java as well. This chapter is all about Bluetooth, so we'll clear up the confusion whenever
there is a clash of terminology here.
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
You may notice that some of these layers are called "protocols" as well. That's because these items are
List
of Figures of the Bluetooth protocol stack. Others like TCP/IP, OBEX, and WAP were not originated by
subprotocols
List
Tables SIG, but they have been incorporated into the Bluetooth protocol. Those subprotocols are
theofBluetooth
List
of Listings
known
as adopted protocols.
List of Sidebars
Host Controller Interface (HCI)
The Host Controller Interface is a layer of software that passes all your data from your computer to your
attached Bluetooth device. For instance, if you are trying to communicate wirelessly from your PC (the
host) and you have a Bluetooth device (the controller) attached to your USB port, then you'll need a layer
that can understand the USB calls and send that information to the upper layers of the stack. Everything
(voice and data) passes though the Host Controller Interface.
Logical Link Control and Adaptation Protocol (L2CAP)
The Logical Link Control and Adaptation Protocol is the core layer of the stack through which all data must
pass. L2CAP boasts some powerful features like packet segmentation and reassembling of data, as well
as protocol multiplexing. If you are trying to pass a very large packet of data, L2CAP breaks up the packet
and sends smaller ones. Conversely, L2CAP also reassembles segmented packets when accepting data.
With protocol multiplexing, L2CAP can accept data from more than one upper protocol at the same time
(like SDP and RFCOMM). Only data passes through the L2CAP layer; audio links have direct access to
the Host Controller Interface.
Service Discovery Protocol (SDP)
A Bluetooth device uses Service Discovery Protocol in order to discover services. What's a Bluetooth
Bluetooth for Java
service? A good example
would be a Bluetooth printer. A Bluetooth printer will publish itself with a
ISBN:1590590783
by"IBruce
Antony
message such as,
am aHopkins
printer, and
howRanjith
can I help
you?" If you have
a document, and you want to print it,
Apress
©
2003
(352
pages)
then you would use the Service Discovery Protocol to find a printer that offers a printer service in your
The authors of this text describe how to develop wireless Java
range.
RFCOMM
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
RFCOMM is commonly known as the wireless serial port, or the cable replacement protocol. The name is
derived from the fact that your serial ports are called COMM1, COMM2, etc. RFCOMM simulates the
Table of Contents
functionality of a standard serial port. For instance, a Bluetooth-enabled PDA would use the RFCOMM
Bluetooth for Java
layer to synchronize its data to a Bluetooth-enabled PC as if they were physically connected by a cable.
Introduction
Chapter 1
- Introducing Bluetooth
Telephony
Control
Protocol Specification (TCS, TCS Binary, TCSChapter
2 - Bluetooth
1.1
Chapter
BIN) 3 - Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Telephony
Protocol
Specification
(TCS, TCS Binary, TCS-BIN) is used to send control signals to
Chapter
5 - Control
Bluetooth
with J2ME
MIDP
devices6that
want to a
employ
the Print
audioServer
capabilities
within
Chapter
- Creating
Bluetooth
with JPS
API Bluetooth. For example, a Bluetooth cordless
phone would
useand
thisOBEX
layer of the protocol to send signals to the base station indicating that the user has
Chapter
7 - Java
requested -toUsing
hanga up
the current call, or to use call waiting, or to place a three-way call, etc.
Bluetooth Simulator
Chapter 8
Chapter 9
- Bluetooth Security
Wireless Access Protocol (WAP)
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
If you've used an Internet-enabled wireless phone before, then you've used WAP. In Bluetooth, this is an
adopted protocol, so the Bluetooth SIG has incorporated the existing WAP protocol into the Bluetooth
Appendix A - javax.bluetooth
protocol to fit Bluetooth's needs. WAP requires that PPP, IP, and UDP be present in the stack.
Chapter 12 - Bluetooth and Jini
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Object Exchange (OBEX)
Appendix D - BlipNet 1.1 API
Index
OBEX is a communication protocol initially defined by the Infrared Data Association (IrDA). Unless you've
worked with infrared, you've probably haven't heard of OBEX. Just like WAP, OBEX was defined by
List of Tables
another group, but it was adopted by the Bluetooth SIG. OBEX is pretty useful when you want to transfer
List of Listings
objects like files between Bluetooth devices. OBEX does not require that TCP and IP be present in the
List
of Sidebars
stack,
but the manufacturer is free to implement OBEX over TCP/IP.
List of Figures
Note A Bluetooth vendor does not need to implement all the Bluetooth protocol layers into its product
in order to be Bluetooth compliant. For instance, a Bluetooth cordless phone may very well only
have HCI, SDP, L2CAP, and TCS implemented into its stack. That's perfectly fine because a
cordless phone may not need any extra functionality.
Bluetooth Network Encapsulation Protocol (BNEP)
The Bluetooth Network Encapsulation Protocol is a layer in the Bluetooth stack that allows other
networking protocols to be transmitted over Bluetooth, namely Ethernet. A Bluetooth vendor has many
options if it wants to implement TCP/IP networking in its Bluetooth device. BNEP is a popular choice
because it encapsulates TCP/IP packets in L2CAP packets before handing off the data to the L2CAP layer
in the stack.
Human Interface Device Protocol (HID)
The Human Interface Device Protocol is another adopted protocol in the Bluetooth specification. It was
originally defined in the USB specification, and it lists the rules and guidelines for transmitting information
to and from human interface devices like keyboards, mice, remote controls, and video game controllers.
Table 2-3 is a handy guide that gives a brief description of the layers of the Bluetooth stack and their
purpose.
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Table 2-3: Layers
of the Bluetooth Protocol Stack
ISBN:1590590783
Apress © 2003 (352 pages)
SHORT
NAME
FULL
NAMEof this text describe how
DESCRIPTION
The
authors
to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based
services, highlights
security
Host Controller Interface
Theoflayer
thatconcerns,
interfacesand
the host (i.e., the PC)
more.
and the controller (the Bluetooth module)
HCI
L2CAP
Logical Link Control and
Table of Contents Adaptation Protocol
Bluetooth for Java
SDP
Introduction
Chapter 1
Service Discovery Protocol
- Introducing Bluetooth
Chapter
2 - Bluetooth
1.1
RFCOMM
RFCOMM
The layer that handles all data transmissions from
upper layers
The layer that discovers services on Bluetooth
devices in the area
The layer that allows you to create a virtual serial
port and to stream data
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
Protocol
Specification
- Creating
a Bluetooth
Print Server with JPS API
TCS-BIN
Chapter
WAP 7
Telephony Control
Chapter 8
- Java and
OBEX Access Protocol
Wireless
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
OBEX
Object Exchange
The layer that allows you to create control signals
for audio applications
The adopted protocol that allows you to view
content in Wireless Markup Language (WML)
The adopted protocol that allows you to send and
receive objects
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter
BNEP12 - Bluetooth
Bluetooth
and Jini
Network
Appendix A - javax.bluetooth
Encapsulation Protocol
Appendix B - javax.obex
The layer that encapsulates other protocol data
packets into L2CAP packets
HID C - Java Bluetooth
Human Interface
The layer
that traffics the controls signals and
Appendix
Development on the PalmOS
Platform
Device
Protocol
Appendix D - BlipNet
1.1 API
data for input devices like keyboards and mice
Index
List of Figures
Note For an exhaustive list of all the new and upcoming Bluetooth protocols, go to the Bluetooth
Member site at http://www.bluetooth.org.
List of Tables
List of Listings
List of Sidebars
Profiles
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
So, let's say that Apress
you own
a Bluetooth-enabled
PDA and a Bluetooth-enabled wireless phone. Both of the
© 2003
(352 pages)
devices have Bluetooth
stacks.
How
can
you
tell
if your
devices wireless
will interact
The authors of this text describe how
to develop
Javaproperly and allow you to
synchronize the phone
lists
between
each
other?
How
will
you
know
if
you
applications using Bluetooth for a variety of platforms. This can send a phone number from
includes
an most
API overview
of thehow
Javacan
library,
development
of
the PDA to the phone?
And
importantly,
you determine
if these
devices will allow you to
Bluetooth-based
services,
highlights
ofwireless
security modem?
concerns, and
browse the Internet
on the PDA using
the phone
as a
more.
That's why the Bluetooth SIG defined profiles. A Bluetooth profile is a designed set of functionality for
Bluetooth devices. For instance, using the examples just listed, the phone and the PDA must both support
Table of Contents
the Synchronization Profile in order to synchronize data between themselves. In order to send object data
Bluetooth for Java
like a .vcf file from the PDA to the phone, both devices need to have the Object Push Profile implemented.
Introduction
And finally, the PDA and the wireless phone must both support the Dial-Up Networking Profile in order for
Chapter 1 - Introducing Bluetooth
the PDA to wirelessly browse the Internet from the phone. If you want your Bluetooth-enabled devices to
Chapter 2 - Bluetooth 1.1
interact, having a Bluetooth stack is not good enough. Those devices also need to implement the same
Chapter
profile. 3 - Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Now, here's
a list of many
of theMIDP
Bluetooth profiles and a description of what they do. For most of them,
Chapter
5 - Bluetooth
with J2ME
you can6 basically
guess
what they
do;Server
the names
areAPI
not cryptic.
Chapter
- Creating
a Bluetooth
Print
with JPS
Chapter 7
- Java and OBEX
Chapter 9
- Bluetooth Security
Note For an exhaustive list of all the Bluetooth profiles, go to the Bluetooth Member site at
Chapter 8 - Using a Bluetooth Simulator
http://www.bluetooth.org.
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Generic Access Profile
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
The Generic Access Profile is the most common Bluetooth profile. All other profiles use this profile for
basic connection establishment. This is the java.lang.Object in the Bluetooth Profile realm; every
Appendix B - javax.obex
profile needs to use the functionality of the GAP.
Appendix A - javax.bluetooth
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Service Discovery Application Profile
Index
List of Figures
The Service Discovery Application Profile is a profile that directly interacts with the Service Discovery
List
of Tables
Protocol
(SDP) layer in the Bluetooth protocol stack. This profile is used to find services on BluetoothList
of
Listings
enabled
devices in the area.
List of Sidebars
Serial Port Profile
The Serial Port Profile is a profile that interacts directly with the RFCOMM layer in the Bluetooth protocol
stack. This profile is used to create a virtual serial port on your Bluetooth-enabled device. For instance,
some Bluetooth kits come with a driver that will allow your operating system to communicate over the
virtual serial port as if it were an actual serial port. As far as the operating system is concerned, it's just
another serial port, as shown in Figure 2-8.
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Figure 2-8: As you can see in Windows 2000, the operating system thinks that COMM10 and
- Understanding the Java Bluetooth API
COMM11 are actual serial ports!
Chapter 4
Chapter 5
- Bluetooth with J2ME MIDP
Chapter
6 Of
- Creating
Server to
with
JPS API
Note
course, aif Bluetooth
you want Print
to connect
another
device over the air using your virtual serial port, then
Chapter 7 you'll
- Javaneed
and OBEX
another Bluetooth-enabled device in the area that also supports the Serial Port
Chapter 8 Profile.
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Dial-Up Networking Profile
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter
If you've
12used
- Bluetooth
a modem
andbefore,
Jini
then you should be familiar with the concept of dial-up networking. The
Dial-Up ANetworking
Profile allows you to mimic the functionality of a modem. Just like the Serial Port
Appendix
- javax.bluetooth
Profile, some
Bluetooth kits come with a driver that will allow your operating system to communicate over
Appendix
B - javax.obex
the virtual
as if it were
an actualon
modem
(see Figure
2-8). As far as the operating system is
Appendix
C -modem
Java Bluetooth
Development
the PalmOS
Platform
concerned,
it's just 1.1
another
Appendix
D - BlipNet
API modem.
Index
Note For such an example to work, you'll need another Bluetooth-enabled device in the area that also
supports the Dial-Up Networking Profile, like a network access point or a wireless phone.
List of Figures
List of Tables
List of Listings
FAX Profile
List of Sidebars
Using the FAX Profile, a Bluetooth-enabled computer can send a fax wirelessly to a Bluetooth-enabled fax
machine or to a Bluetooth-enabled wireless phone.
Headset Profile
The Headset Profile is primarily designed for connecting Bluetooth-enabled headsets to Bluetoothenabled wireless phones.
LAN Access Profile
A Bluetooth-enabled device such as a PC or laptop will use the LAN Access Profile to connect to a
network access point connected to a LAN.
Personal Area Networking Profile
The Personal Area Networking Profile is pretty much similar to the LAN Access Profile, except it also has
support for devices to form ad-hoc networks among themselves. The PAN Profile also has a requirement
that BNEP be present in the underlying protocol stack.
Cordless Telephony
Profile
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
The Cordless Telephony Profile allows you to use a Bluetooth-enabled handset to connect to a BluetoothApress © 2003 (352 pages)
enabled "landline" phone to place calls. For instance, through this profile, you continue to receive calls to
The authors of this text describe how to develop wireless Java
your home phone,
but you have the convenience of answering that call on your Bluetooth wireless phone,
applications using Bluetooth for a variety of platforms. This
without using the includes
minutesan
of API
the overview
calling plan
of your
phone.
of the
Java wireless
library, development
of
Bluetooth-based services, highlights of security concerns, and
more.
Intercom Profile
If twoofBluetooth-enabled
devices are within range, and they support the Intercom Profile, then they can
Table
Contents
function for
justJava
like regular intercoms.
Bluetooth
Introduction
Generic
- Introducing
Object Bluetooth
Exchange Profile
Chapter 1
Chapter 2
- Bluetooth 1.1
The Generic
Object
Exchange
Profile is the generic profile that all profiles use if they want to employ the
Chapter
3 - Before
You
Get Started
functionality
of the OBEX protocol in the Bluetooth stack.
- Understanding the Java Bluetooth API
Chapter 4
Chapter 5
- Bluetooth with J2ME MIDP
Object -Push
Creating Profile
a Bluetooth Print Server with JPS API
Chapter 6
Chapter 7
- Java and OBEX
Chapter 9
- Bluetooth Security
The Object Push Profile provides the functionality for a device to push and pull an object. Using this
Chapter 8 - Using a Bluetooth Simulator
profile, though, you are limited to a certain class of objects like vCards.
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
File Transfer Profile
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
The File Transfer Profile is a more robust profile for transferring objects. You can use the File Transfer
Profile to transfer files and folders from one Bluetooth-enabled device to another.
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Synchronization Profile
Appendix D - BlipNet 1.1 API
Index
You use the Synchronization Profile to synchronize data between two Bluetooth-enabled devices. The
most common applications for this profile would be to synchronize data between a PDA and a PC.
List of Figures
List of Tables
List of Listings
Basic Printing Profile
List of Sidebars
The Basic Printing Profile allows a Bluetooth-enabled device to send plain text to a Bluetooth-enabled
printer for printing.
Hard Copy Cable Replacement Profile
The Hard Copy Cable Replacement Profile is what we call the "Advanced Printing Profile." With this
profile, you can print any printable document to a Bluetooth-enabled printer. If you don't already have the
driver for that printer, that's okay; the printer will give it to you.
Basic Imaging Profile
The Basic Imaging Profile is intended to be used by imaging devices like cameras for remote control,
image transfers, and downloading.
Hands Free Profile
The Bluetooth-enabled hands-free kits in automobiles use the Hands Free Profile to allow the driver to
place and receive calls from a Bluetooth-enabled phone.
Human Interface
BluetoothDevice
for Java Profile
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
As you might have guessed, the Human Interface Device Profile has a requirement that the HID Protocol
Apress © 2003 (352 pages)
must exist in the underlying Bluetooth stack. This profile defines the case scenarios for using BluetoothThe authors of this text describe how to develop wireless Java
enabled human interface
devices like keyboards and mice. One of the goals of this profile is that a
applications using Bluetooth for a variety of platforms. This
Bluetooth-enabled
device
that
run for of
three months on three AAA
includes an
APIconforms
overview to
ofthe
the HID
JavaProfile
library,should
development
alkaline batteries.Bluetooth-based services, highlights of security concerns, and
more.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
Profile Interdependencies
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
The profiles are heavily
dependent
upon each other, and you should already know that every profile
Apress ©
2003 (352 pages)
depends upon the
Generic
Access
Profile.
The Bluetooth
profiles
were designed
to be building blocks,
The authors of this text describe
how to develop
wireless
Java
where a higher level
profile
is
dependent
upon
the
functionality
of
the
lower
profiles
to exist. Take a look at
applications using Bluetooth for a variety of platforms. This
includes
an Bluetooth
API overview
of theare
Java
library, development
Figure 2-9 and see
how the
profiles
dependent
upon each of
other for functionality.
Bluetooth-based services, highlights of security concerns, and
more.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Figure
Bluetooth
Appendix
D - 2-9:
BlipNet
1.1 API profile interdependencies
Index
List
Figures in order for a PDA vendor to say that it supports the Synchronization Profile for its new
Forofexample,
List
of Tables
Bluetooth-enabled
BJL 200 PDA, it also must support the Generic Object Exchange Profile, Serial Port
List
of Listings
Profile,
and Generic Access Profile because the Synchronization Profile cannot function without them. If a
List
phone
of Sidebars
manufacturer claims that its new Bluetooth-enabled TLJ 50 headset supports the Headset Profile,
then it must also include the Serial Port Profile and the Generic Access Profile.
Bluetooth Profiles vs. J2ME Profiles
Do not get Bluetooth profiles confused with J2ME profiles. J2ME profiles are a set of Java classes that
extend the functionality of a J2ME Configuration. For instance, the PDA and MID Profiles are both a
set of Java classes that extend the functionality of the Connected Limited Device Configuration. On the
otherhand, a Bluetooth profile can be implemented in any language and on any platform, because it
refers to a defined set of functionality for a Bluetooth-enabled device. So, the Object Push Profile can
be implemented on a Palm OS PDA in C++, and it can also be implemented on a Bluetooth-enabled
printer in Assembler; it's just a defined set of functionality.
Bluetooth
for Java
Personal Area
Networks:
Piconets and Scatternets
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
When two or more
Bluetooth-enabled
Apress
© 2003 (352 pages)devices come within range and establish a connection, a personal
area network is formed.
A personal
areadescribe
networkhow
cantoeither
be a
piconetJava
or a scatternet. Figure 2-10
The authors
of this text
develop
wireless
shows Bluetooth applications
devices in ausing
piconet.
Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter
7 - 2-10:
Java and
Figure
In aOBEX
piconet, the slaves can only communicate to the master.
Chapter 8 - Using a Bluetooth Simulator
A Bluetooth
piconet has
a single master and up to seven slaves. No matter what kind of Bluetooth devices
Chapter
9 - Bluetooth
Security
are involved
(they can
be phones,
access
points,
PDAs,
laptops, headsets, etc.), the master of the piconet
Chapter
10 - Wireless
Embedded
Systems
with
the Micro
BlueTarget
is the one
initiatesBluetooth
the connection.
The device
that
accepts
the connection automatically becomes the
Chapter
11 -that
Enterprise
Applications
with the
Ericsson
BlipNet
slave. Master/slave
Chapter
12 - Bluetoothroles
and are
Jini not predefined, so if a piconet exists between a laptop and a PDA, either
device could be the master or the slave.
Appendix A - javax.bluetooth
Appendix
- javax.obex
NoteB In
certain conditions, a role switch between the master and slave is allowed. These conditions
Appendix C are
- Java
Bluetooth
Development
the PalmOS Platform
explained
in the
Bluetoothon
specification.
Appendix D - BlipNet 1.1 API
So what happens to the piconet if a new Bluetooth device wants to join the piconet after the master has
Index
acquired
seven slaves? Does it shut down? Will older members of the piconet get kicked off? No, actually,
List
of Figures
theofmaster
List
Tables of the piconet will not invite new members to join until at least one the old members leaves (or
goes
into an inactive state). Now, on the other hand, if one of the slaves in the Bluetooth piconet also
List
of Listings
happens to be multipoint-capable, then the newcomer can create a piconet with that slave, thereby
creating a scatternet (as shown in Figure 2.11). A scatternet will also be created if the master of the
existing piconet becomes a slave to the newcomer.
List of Sidebars
Figure 2.11: A scatternet is formed when a slave in one piconet is the master in another piconet.
Bluetooth
for Java
The Bluetooth
Qualification
Process
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
Okay, so what does
it take
to turn
a product that uses Bluetooth technology into an official BluetoothApress
© 2003
(352 pages)
certified product?The
Well,
you
first
need
to describe
join the Bluetooth
SIG. wireless
How do Java
you join? Just go to
authors of this text
how to develop
http://www.bluetooth.org
and
fill
out
the
membership
form.
After
applications using Bluetooth for a variety of platforms. This becoming a member, you need
includes
API overview
of the Java
library, development
of
to submit your product
foran
testing
by a Bluetooth
Qualification
Body. The Qualification
Body will test your
services,
highlights
security
concerns, andwith other devices that use
device against theBluetooth-based
current Bluetooth
specification
asofwell
as interoperability
more.
your Bluetooth profiles.
Note Java developers really don't need to join the Bluetooth SIG or undergo the qualification process
if prequalified Bluetooth materials (i.e., stacks and radios) are used in their products. However, if
Bluetooth for Java
you want to use that really cool-looking Bluetooth logo on your products, then you need to join
Introduction
the SIG.
Table of Contents
Chapter 1
- Introducing Bluetooth
Chapter
2 - Bluetooth
1.1
Once testing
has been
completed, and if your device passes the tests, it will be listed on the Bluetooth
Chapter
Qualification
3 - Before
Web site
You (http://qualweb.bluetoothsig.org).
Get Started
Most companies will postpone
Chapter
announcing
4 - Understanding
their new Bluetooth-enabled
the Java Bluetooth
product
API until it has been certified, so check that site often to see
"who's 5doing
what" in with
Bluetooth.
Chapter
- Bluetooth
J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Summary
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
In this chapter you
learned
all (352
about
Bluetooth devices, and you found out what they look like. By now, you
Apress
© 2003
pages)
should also knowThe
about
the
role
of
the
protocol
stack wireless
and howJava
it interacts with your Bluetooth
authors of this textBluetooth
describe how
to develop
hardware. You should
take
away
from
this
chapter
a
finite
knowledge
of
Bluetooth
profiles, and you should
applications using Bluetooth for a variety of platforms. This
anserve.
API overview
theshould
Java library,
development
of
know the purposeincludes
that they
Finally,ofyou
be aware
of the difference
between piconets and
Bluetooth-based
highlights
concerns,
scatternets, and you
should knowservices,
what it takes
to getofasecurity
Bluetooth
device and
certified.
more.
Great! You now should have a good understanding of how the Bluetooth protocol works. In the next
chapter, we'll see what happens when we throw in Java.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
for Java
Chapter Bluetooth
3: Before
You Get Started
ISBN:1590590783
by Bruce Hopkins and Ranjith Antony
Apress
© 2003
(352and
pages)
Okay, now that you
know
the ins
outs of Bluetooth, you're probably eager to find out how to integrate
The
authors
of
this
textisdescribe
how
to develop
wireless
Java
Bluetooth with Java. Well, this chapter
all about
doing
just that.
But wait!
Before you learn about how to
applications using Bluetooth for a variety of platforms. This
use Bluetooth and Java, you need to know when it is not a good idea to use the two technologies together.
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
When NOT to Use Bluetooth and Java
You should not use Bluetooth with Java for the following purposes:
Table of Contents
Bluetooth
for strength
Java
Signal
indicator
Introduction
Voice
Chapter
1 -applications
Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Distance measuring
Chapter
4 few
- Understanding
the Java
Bluetooth
API scenarios.
The next
sections explain
why to
avoid those
Chapter 5 - Bluetooth with J2ME MIDP
Chapter 6
Creating a Bluetooth Print Server with JPS API
Signal -Strength
Indicator
Chapter 7
- Java and OBEX
Chapter
8 that
- Using
Bluetooth
Simulatorunits, and you want to know what the signal strength is between
Let's say
you ahave
two Bluetooth
Chapter
- Bluetooth
Security
them. A9 good
example
is when you want to use the services of a network access point. A signal strength
Chapter
indicator
10would
- Wireless
let you
Embedded
know if you
Systems
werewith
within
therange.
Micro Well,
BlueTarget
Java is not the ideal language for that sort of
application
kind of Applications
information with
is notthe
exposed
the level where a JVM would have access to
Chapter
11 - because
Enterprisethat
Bluetooth
EricssontoBlipNet
it. The JVM
will let youand
know
Chapter
12 - Bluetooth
Jini if you are within range or not within range; there is no middle ground. In this
scenario,
better off using a native language for your device such as C or C++.
Appendix
A you're
- javax.bluetooth
Appendix B - javax.obex
Voice Applications
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Now, you've already read Chapter 2, and you realize that Bluetooth is a really great technology because
Index
youofhave
the ability to transmit voice and data information wirelessly to other Bluetooth devices. Suddenly,
List
Figures
youofget
ideas bubbling in your head about how great it would be to create a speech-to-text application on
List
Tables
your Bluetooth-enabled phone. Unfortunately, Java (especially J2ME) is not well suited to this arena just
yet. Performance is a key factor in voice-based applications, and once again, in this case, you're better off
List of Sidebars
using a native language such as C. However, this application may be feasible to do in Java if the Java
Real-Time Technology can be incorporated.
List of Listings
Distance Measuring
The best wireless technology for accurately measuring distance is light waves and not radio signals. Light
waves are direct, and the calculations can be pretty simple because the speed of light (in various
mediums) is pretty well documented. Using radio signals to measure distance can be quite tricky, and one
of the best ways to do that is to use triangulation, like GPS transceivers do. Whether you are using Java or
C, Bluetooth might be a viable technology for triangulation, but definitely not for calculating or measuring
accurate distances.
Note The key word here is accurate. You can definitely use Bluetooth for proximity measurement (i.e.,
where in the building is Bruce Hopkins?). In fact, the Ericsson BlipNet does exactly that! See
Chapter 11 for more information on the Ericsson BlipNet.
So, to put it succinctly, you can only do what is possible using the constraints of the Bluetooth technology
and what the JVM exposes to you. If the JVM only gives you access to the RFCOMM layer for
communication, then you're stuck with it. If the OBEX layer is not exposed to the JVM, then don't expect to
be able to send objects. To increase application portability, your Java Bluetooth vendor should implement
the Java Bluetooth specification created through the JCP.
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth
Java
Understanding
theforJCP
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
The JCP is the Java
Community
and it is the formal procedure to get an idea from a simple
Apress
© 2003 (352Process,
pages)
concept incorporated
into
the
Java
standard.
Thishow
process
allows
developers
The authors of this text describe
to develop
wireless
Java and industry experts to
shape the future applications
of the Java standard.
Popular
APIs
like
Java
USB,
Java
using Bluetooth for a variety of platforms. ThisReal-Time, Java Printing, Java
includes
API overview
ofJDBC
the Java
development
New I/O, J2ME MIDP
1.0,an
J2ME
MIDP 2.0,
3.0,library,
EJB 2.0,
and even of
JDK 1.4 all went through the
services,
highlights
of security
concerns,
andJava language, or if you want
Java CommunityBluetooth-based
Process. If you want
to add
some new
functionality
to the
more.
to suggest a new API, or if you think that some new classes should have a package name of java.* or
javax.*, then you need to go through the JCP.
Table of Contents
The Role of the JSR-82
Bluetooth for Java
Introduction
A JSR 1is a-Java
Specification
Request in the Java Community Process. The JSR-82 is the formal JCP
Chapter
Introducing
Bluetooth
name for
Java APIs
Chapter
2 the
- Bluetooth
1.1for Bluetooth. When a proposed JSR is approved, an Expert Group is formed by
the specification
lead.
specification lead for the JSR-82 was Motorola, and together with the JSR-82
Chapter
3 - Before
You The
Get Started
Expert 4Group,
they createdthe
theJava
official
Java Bluetooth
APIs. The following companies participated in the
Chapter
- Understanding
Bluetooth
API
JSR-825 Expert
Group:with J2ME MIDP
Chapter
- Bluetooth
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Extended
Systems
Chapter 7
- Java and OBEX
Chapter
IBM
8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Mitsubishi
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter
11 - Enterprise
Bluetooth Applications with the Ericsson BlipNet
Newbury
Networks
Chapter 12 - Bluetooth and Jini
Nokia
Appendix
A - javax.bluetooth
Appendix B - javax.obex
Parthus Technologies
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix
D - BlipNet
1.1 API
Research
in Motion
(RIM)
Index
List ofRococo
Figures Software
List of Tables
Sharp Electronics
List of Listings
List ofSony
Sidebars
Ericsson
Smart Fusion
Smart Network Devices
Sun Microsystems
Symbian
Telecordia
Vaultus
Zucotto
The JSR-82 Expert Group also had three individual experts: Peter Dawson, Steven Knudsen, and Brad
Threatt.
What Is the RI and TCK?
According to the Java Community process, the specification lead company is responsible for creating a
Reference Implementation (RI) and also a Technology Compatibility Kit (TCK). The Reference
Implementation is basically a proof of concept to prove that the specification can be implemented. Other
companies are free to implement the JSR-82, and in order to certify that their vendor kit is compliant to the
for Java
JSR-82 standard,Bluetooth
that vendor's
product must pass the TCK.
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
Apress © 2003
(352 pages)
The JSR-82 specification
actually
has two Reference Implementations and Technology Compatibility Kits.
Why did they do this?
Recall of
in this
Chapter
2 that the
Bluetooth
SIGwireless
has adopted
The authors
text describe
how
to develop
Java some preexisting protocols
applications using
Bluetooth
a variety
platforms.
in the Bluetooth specification,
namely
OBEX.for
The
OBEX of
protocol
wasThis
used with infrared technology for
includes
API overview
of was
the Java
development
of
object transmissions
longan
before
Bluetooth
evenlibrary,
invented.
The designers
of the Java Bluetooth
Bluetooth-based services, highlights of security concerns, and
specification decided
not
to
tie
OBEX
to
Bluetooth
when
creating
the
Java
Bluetooth
standard. Therefore,
more.
the JSR-82 actually consists of two independent packages:
javax.bluetooth
(the 13 classes and interfaces that are needed to perform wireless
Table of
Contents
communication
with the Bluetooth protocol)
Bluetooth
for Java
Introduction
javax.obex (the 8 classes that are needed to send objects between devices, independent of the
- Introducing Bluetooth
transport
mechanism between them)
Chapter 1
Chapter 2
- Bluetooth 1.1
Chapter
So, to answer
3 - Before
yourYou
nextGet
question,
Started yes, you can use OBEX without Bluetooth. Bluetooth is simply one of
many transports
with whichthe
OBEX
operate.
Chapter
4 - Understanding
Java can
Bluetooth
API
Chapter 5
- Bluetooth with J2ME MIDP
The classes and interfaces that comprise the Java Bluetooth specification are briefly described in Tables
- Creating a Bluetooth Print Server with JPS API
3-1 and 3-2. These classes and their methods are covered as needed in the following chapters, and their
Chapter 7 - Java and OBEX
APIs are listed in detail in Appendix A and Appendix B.
Chapter 6
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Table 3-1: Classes in the javax.bluetooth Package
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
CLASS
DESCRIPTION
Chapter
11 NAME
- Enterprise Bluetooth Applications with
the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
DiscoveryListener
Appendix A - javax.bluetooth
Appendix B - javax.obex
TheDiscoveryListener interface allows an
application to receive device discovery and service
discovery events.
Appendix C - Java Bluetooth Development on the PalmOS Platform
L2CAPConnection
Appendix
D - BlipNet 1.1 API
Index
ListL2CAPConnectionNotifier
of Figures
List of Tables
List of Listings
TheL2CAPConnection interface represents a
connection-oriented L2CAP channel.
TheL2CAPConnectionNotifier interface provides
an L2CAP connection notifier.
ServiceRecord
TheServiceRecord interface describes
characteristics of a Bluetooth service.
DataElement
TheDataElement class defines the various data
types that a Bluetooth service attribute value may have.
DeviceClass
TheDeviceClass class represents the class of
device (CoD) record as defined by the Bluetooth
specification.
DiscoveryAgent
TheDiscoveryAgent class provides methods to
perform device and service discovery.
LocalDevice
TheLocalDevice class represents the local
Bluetooth device.
RemoteDevice
TheRemoteDevice class represents a remote
Bluetooth device.
UUID
TheUUID class defines universally unique identifiers.
BluetoothConnectionException
This BluetoothConnectionException is thrown
when a Bluetooth connection (L2CAP, RFCOMM, or
OBEX) cannot be established successfully.
List of Sidebars
TheBluetoothStateException is thrown when a
request
the Bluetooth system that the
by Bruce Hopkins and Ranjith
Antonyis made toISBN:1590590783
system
cannot
support
in its present state.
Apress © 2003 (352 pages)
BluetoothStateException
Bluetooth for Java
The authors of this text describe
how to develop wireless Java
ServiceRegistrationException
TheServiceRegistrationException
is thrown
applications using Bluetooth for a variety of platforms. This
when there is a failure to add a service record to the
includes an API overview of the Java library, development of
local Service
Discovery
Database
Bluetooth-based services, highlights
of security
concerns,
and (SDDB) or to modify
an existing service record in the SDDB.
more.
Table of Contents
Table 3-2: Classes in the javax.obex Package
Bluetooth for Java
CLASS NAME
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Authenticator
Chapter 3
DESCRIPTION
This interface provides a way to respond to authentication
challenge and authentication response headers.
- Before You Get Started
ClientSession
TheClientSession
interface provides methods for OBEX
Chapter
4 - Understanding the Java Bluetooth
API
Chapter 5
requests.
- Bluetooth with J2ME MIDP
Chapter
6 - Creating a Bluetooth PrintThe
Server
with JPS API
HeaderSet
HeaderSet
interface defines the methods that set and get
Chapter 7 - Java and OBEX
the values of OBEX headers.
Chapter 8
- Using a Bluetooth Simulator
TheOperation interface provides ways to manipulate a single
OBEX PUT or GET operation.
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter
11 - Enterprise Bluetooth Applications
with the Ericsson BlipNet
SessionNotifier
TheSessionNotifier
interface defines a connection notifier
Chapter 12 - Bluetooth and Jini
for server-side OBEX connections.
Operation
- Bluetooth Security
Chapter 9
Appendix A - javax.bluetooth
PasswordAuthentication
Appendix B - javax.obex
This class holds user name and password combinations.
ResponseCodes
TheResponseCodes
class contains the list of valid response
Appendix
C - Java Bluetooth Development
on the PalmOS Platform
Appendix D - BlipNet 1.1 API
codes a server may send to a client.
Index
TheServerRequestHandler class defines an event listener
that will respond to OBEX requests made to the server.
ServerRequestHandler
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth
Java Bluetooth API
The Benefits
of theforJava
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
There are two key
advantages
to using
Apress
© 2003 (352
pages) the official Java Bluetooth API versus a C-based (or native) API:
The authors of this text describe how to develop wireless Java
API is independent
of theusing
stackBluetooth
and radiofor a variety of platforms. This
applications
includes an API overview of the Java library, development of
StandardizedBluetooth-based
Bluetooth API services, highlights of security concerns, and
more.
API Is Independent of Stack and Radio
Table of Contents
So what makes the official Java Bluetooth API better than a C/C++ Bluetooth API? One of the principle
reasons is that the JSR-82 API is independent of the stack and the Bluetooth hardware. That gives you the
Introduction
ability to write applications without any knowledge of the underlying Bluetooth hardware or stack. And
Chapter 1 - Introducing Bluetooth
that's essentially what Java gives you today. If you write standard Java code (without any native methods),
Chapter 2 - Bluetooth 1.1
you can run your code on basically any hardware platform and on any OS with little or no modification.
Chapter
3 it's
- Before
You Get Started
Whether
an appli-cation,
applet, midlet, servlet, or EJB, you can code your application on one platform
Chapter
4
Understanding
the Java Bluetooth API
and deploy to another platform.
Bluetooth for Java
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
The Only
Standardized Bluetooth API
- Java and OBEX
Chapter 7
Chapter
8 -a
Using
a Bluetooth
Simulator
If you have
C/Cbased
Bluetooth
SDK, then you are basically at the mercy of the vendor. There is no
Chapter
9 for
- Bluetooth
Security
standard
a C/Cbased
Bluetooth SDK, so each vendor is free to name functions and methods to
Chapter
10 they
- Wireless
Embedded
withfive
the profiles
Micro BlueTarget
whatever
choose.
Vendor Systems
A may have
in its SDK, and Vendor B may only have three. If
Chapter
11 to
- Enterprise
Bluetoothhardware
Applications
with the
Ericsson
BlipNet
you want
change Bluetooth
or stack
libraries,
then
you'll need to rewrite your Bluetooth
Chapter
application
12 - and/or
Bluetooth
change
and Jini
its functionality. Because the JSR-82 is the official Java API for Bluetooth, all
vendors Awho
implement the standard must include a core set of layers and profiles in their Bluetooth SDK.
Appendix
- javax.bluetooth
Appendix B - javax.obex
A JSR-82-compliant Bluetooth stack must include the following layers:
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix
- BlipNet 1.1
API
HostDController
Interface
(HCI)
Index
List ofLogical
FiguresLink Control and Adaptation Protocol (L2CAP)
List of Tables
Service Discovery Protocol (SDP)
List of Listings
List ofRFCOMM
Sidebars
These profiles are also required:
Generic Access Profile
Service Discovery Application Profile
Serial Port Profile
Generic Object Exchange Profile
CROSSREFERENCE
See "The Bluetooth Protocol Stack" and "Profiles" in Chapter 2 for details on the
Bluetooth protocol stack and profiles just in case you forgot.
The first thing that may come to your mind is, "Hey, wait a minute, doesn't the Bluetooth specification
contain more profiles than that? Why did they implement only a few profiles in Java?" Well, here are two
major reasons:
First of all, the JSR-82 team wanted to get the Java Bluetooth specification in the hands of developers as
quickly as possible. Recall in Chapter 2 that Bluetooth profiles are designed to be functional enough
where higher profiles extend the functionality of the lower, or base, profiles. Refer to Figure 2-9, which
shows a diagram of the relationship of the profiles of the Bluetooth specification.
Secondly, by implementing the base profiles (Generic Access Profile, Service Discovery Application
Bluetooth for Java
Profile, Serial Port
Profile, and Generic Object Exchange Profile), the SDK vendor or the application
ISBN:1590590783
Bruce Hopkins
Ranjith
Antony
developer is free by
to implement
theand
higher
profiles
of the Bluetooth
specification.
Apress © 2003 (352 pages)
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth
Java
What You Need
tofor
Get
Started
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
We know that thisApress
question
has
been
on your mind for a while. Well, here's a list of what you'll need:
© 2003
(352
pages)
The authors of this text describe how to develop wireless Java
Bluetooth devices
(at least
two)
applications
using
Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth host
(at least one) services, highlights of security concerns, and
Bluetooth-based
more.
Bluetooth stack
Java
Bluetooth API
Table of
Contents
Bluetooth for Java
Now let's cover all these components in detail and describe how they all work together.
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 3
- Before You Get Started
Bluetooth
Devices
Chapter
2 - Bluetooth
1.1
Bluetooth devices were covered in Chapter 2, but just in case you forgot, take another look at Figures 2-1,
- Understanding the Java Bluetooth API
2-2, and 2-3. Remember, Bluetooth devices are simply radios, so getting a single device is just like getting
Chapter 5 - Bluetooth with J2ME MIDP
a single walkie talkie; it's pretty useless. If your Bluetooth device is point-to-point capable, then that means
Chapter 6 - Creating a Bluetooth Print Server with JPS API
it can only talk to a single Bluetooth device at a time. If it is multipoint capable, then it can talk to up to
Chapter
7 - Java
OBEX
seven devices
atand
a time.
The Bluetooth device is also known as the controller.
Chapter 4
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Bluetooth Host
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter
11 - Enterprise
Bluetooth
Applications
with the Ericsson
BlipNet
The Bluetooth
host is the
computer
that is physically
connected
to the Bluetooth device. For the most part,
Chapter
12
Bluetooth
and
Jini
this is your desktop PC, laptop, PDA, or smart phone. Usually, the connection is USB, RS-232, or UART.
Appendix A - javax.bluetooth
Now, you
definitely going to need two Bluetooth devices, but you can get away with having only one
Appendix
B are
- javax.obex
Bluetooth
does Development
this work? Well,
if you
have Platform
a PC that has two serial ports or two USB ports (or
Appendix
C host.
- JavaHow
Bluetooth
on the
PalmOS
both), then
can1.1
connect
Appendix
D - you
BlipNet
API both of your Bluetooth devices to your PC's ports. In order for this to work, you
need to start two instances of your JVM; each JVM will have its own Bluetooth device.
Index
List of Figures
The Bluetooth host must meet the minimum requirements for the CLDC, so you need at least 512k total
List
of Tables
memory
for the JVM.
List of Listings
List of Sidebars
Bluetooth Stack
A Bluetooth stack is required in order for a Bluetooth host (the PC) to properly communicate to the
Bluetooth device (the controller). If you go back to Figure 2-6, which shows a diagram of the Bluetooth
stack, the bottom layer of the stack is the Host Controller Interface! See, it does make sense. The Host
Controller Interface is literally the software required to interface the Bluetooth host and the Bluetooth
device (the controller).
Since this book is all about Java and Bluetooth, you might think that the Bluetooth stack needs to be
written completely in the Java language. Well, not exactly. Some Bluetooth vendors have implemented a
completely all-Java stack, while others have implemented a Java interface (i.e., JNI or other means) to a
native stack. Either way, you need to access the stack through Java code, whether or not the stack is in
Java.
Java Bluetooth API
Finally, you're going to need a set of libraries to interface with your stack. For the most part, a company will
sell you a Java Bluetooth API and Bluetooth stack together in a kit. Just be sure to ask them what
Bluetooth devices their kit supports.
Another question to ask your Java Bluetooth kit vendor is if their product is JSR-82 compliant. Currently,
JSR-82 can only be implemented on the J2ME platform. JSR-82 cannot be implemented on the J2SE
platform because the J2SE does not support the Generic Connection Framework. Hopefully, the Generic
Bluetooth for Java
Connection Framework
will be implemented by JDK 1.5.
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
Apress
© 2003
(352 pages) the GCF in the JDK is JSR-197.
Note The official
JSR
to implement
The authors of this text describe how to develop wireless Java
Does this mean that
it is impossible
to do Java
Bluetooth
development
applications
using Bluetooth
forand
a variety
of platforms.
This on the J2SE platform? No, it
includes
an API
overview
of the
Javayou
library,
development
of not be compliant with JSR-82
simply means that
whatever
Java
Bluetooth
kit that
obtain
for J2SE will
services,ishighlights
of security
concerns,
and ramification of this problem is
until the Generic Bluetooth-based
Connection Framework
implemented
in J2SE.
The major
more.
that your J2ME and J2SE code may be drastically different from each other, even if you are doing the
same thing.
Table of Contents
Java Bluetooth Vendor SDKs
Bluetooth for Java
Introduction
So, who's
Java Bluetooth
Bluetooth SDKs, and which are JSR-82 compliant? Fortunately, there is a plethora
Chapter
1 -offering
Introducing
of Java2Bluetooth
SDKs
Chapter
- Bluetooth
1.1to fit the needs that your application requires. Vendor support is available for Java
Bluetooth
on Started
a wide range of operating systems and JVM platforms. Table 3-3 displays
Chapter
3 development
- Before You Get
various4attributes
of many the
Java
Bluetooth
SDKs.
Chapter
- Understanding
Java
Bluetooth
API
Chapter 5
- Bluetooth with J2ME MIDP
Table 3-3:- Java
Bluetooth SDK Vendors [*]
Creating a Bluetooth Print Server with JPS API
Chapter
7 - Java and
OBEX
COMPANY
JSR-82
JSR-82
Chapter
Bluetooth Simulator
NAME8 - Using aJAVAX.BLUETOOTH
JAVAX.OBEX
Chapter 9 - Bluetooth
SUPPORT
Security
SUPPORT
Chapter 6
SUPPORTED
JAVA
PLATFORMS
SUPPORTED
OPERATING
SYSTEMS
Yes
J2ME, J2SE
Win-32, Linux,
Pocket PC
No
Waba JVM
uClinux
No
J2SE
Win-32, Linux
No
J2ME
Win-32, Palm
OS, Pocket PC,
many others
No
No
J2SE
Win-32, Linux,
others
Possio
Yes
Yes
J2ME
Win-32, Linux
Rococo
Yes
Yes
J2ME, J2SE
Win-32, Linux,
Palm OS,
Pocket PC
Smart
Network
Devices
Yes
No
J2ME
HyNetOS
SuperWaba
No
No
Waba JVM
Palm OS
Zucotto
No
No
J2ME, J2SE
Win-32
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Atinav
Yes
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix
BlueGiga
A - javax.bluetooth
No
Appendix B - javax.obex
Ericsson
No
Appendix C - Java Bluetooth Development on the PalmOS Platform
Esmertec
Appendix
D - BlipNetYes
1.1 API
Index
List of Figures
ListHarald
of Tables
List of Listings
List of Sidebars
[*]The
information in this table is subject to change, so check the companion Web site
http://www.javabluetooth.com for up-to-date information. Palm OS is a registered
trademark of Palm, Inc.
Summary
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
This chapter has Apress
only skimmed
the
surface of how to integrate Java Bluetooth. You learned about the
© 2003 (352
pages)
advantages of using
Java
versus
C
for
development.
You also
learned about JSR-82 as well
The authors of this textapplication
describe how
to develop wireless
Java
as what it takes toapplications
get things using
up and
running.
Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based
services,
highlightsJava
of security
concerns, as
and
In the next chapter,
we'll focus more
on integrating
and Bluetooth,
well as introduce some
more.
example code.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
for Java
Chapter Bluetooth
4: Understanding
the Java
Bluetooth API
ISBN:1590590783
by Bruce Hopkins and Ranjith Antony
Apress
2003 (352
pages)
This chapter will be
your©formal
introduction
to the Java Bluetooth API. We'll cover a vast majority of the classes
The
authors
of
this
how
to to
develop
wireless
Java
in the javax.bluetooth packagetext
anddescribe
examine
how
use them
in your
applications. Rather than looking at
applications using Bluetooth for a variety of platforms. This
every class and interface individually, we'll take a different approach by first looking at the basic components of a
includes an API overview of the Java library, development of
typical Bluetooth Bluetooth-based
application (Javaservices,
or otherwise).
After
we haveconcerns,
identifiedand
these components, we'll explain how to
highlights
of security
use the Java Bluetooth
more. API in order to create wireless applications.
The Basic Components of a Bluetooth Application
Table of Contents
Bluetooth for Java
The basic components of any Bluetooth application consist of the following items:
Introduction
Chapter
1 -initialization
Introducing Bluetooth
Stack
Chapter 2
- Bluetooth 1.1
Device
management
Chapter
3 - Before
You Get Started
Chapter 4
the Java Bluetooth API
Device- Understanding
discovery
Chapter 5
- Bluetooth with J2ME MIDP
Chapter
Service
6 - Creating
discovery
a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Service registration
Chapter 8 - Using a Bluetooth Simulator
Chapter
9 - Bluetooth Security
Communication
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
The Java
specification
adds a special
the mix called the Bluetooth Control Center
Chapter
11 Bluetooth
- Enterprise
Bluetooth Applications
with component
the Ericsson to
BlipNet
(BCC).12
We'll
talk about
the
BCC in the next section because in some vendor implementations, stack initialization
Chapter
- Bluetooth
and
Jini
is handled
the BCC.
Appendix
A -through
javax.bluetooth
Appendix B - javax.obex
The Bluetooth Control Center
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
The Bluetooth Control Center is an awkward beast due to its ambiguity. It is required to exist in a JSR-82
Index
compliant
implementation, but there are no guidelines in the official Java Bluetooth specification about how it
List
of Figures
should
be implemented. One vendor could implement the BCC as a set of Java classes, and another vendor
List
of Tables
could implement it as a native application on the Bluetooth host. But no matter how it is implemented, it is an
integral part of your security architecture because the BCC defines device-wide security settings for your
List of Sidebars
Bluetooth device.
List of Listings
Now, for the most part, if you are working with a JSR-82-compliant Java Bluetooth development kit within your
development environment, then the BCC will probably be implemented as one or more Java classes. But
because the BCC is vendor specific, the classes that form the BCC will not have a javax.bluetooth package
name; they will be in the form of something like com.vendor.bluetooth.bcc. Now, if you're working with a
device that comes with the Java Bluetooth standard (like a mobile phone or a PDA), then there is a high
probability that the BCC would be implemented as a native application on that device.
According to the Java Bluetooth specification, these are the requirements of the BCC:
Include base security settings of the device.
Provide a list of Bluetooth devices that are already known. The devices do not need to be within range.
Provide a list of Bluetooth devices that are already trusted. The devices do not need to be within range.
Provide a mechanism to pair two devices trying to connect for the first time.
Provide a mechanism to provide for authorization of connection requests.
Information contained in the BCC must not be modified or altered other than by the BCC itself.
Depending upon the JSR-82 implementation that you're using, the BCC may need to be packaged and deployed
with your application code.
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Stack Initialization
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
Now before you can
do anything, your stack needs to be initialized. Remember, a Bluetooth stack has direct
applications using Bluetooth for a variety of platforms. This
access to the underlying
device.ofStack
initialization
can consistofof a number of things, but its main
includes Bluetooth
an API overview
the Java
library, development
purpose is to get Bluetooth-based
the Bluetooth device
services,
ready
highlights
to start of
wireless
security
communication.
concerns, and Stack initialization sequences can
more.
vary, and it's heavily
dependent upon the underlying OS and Bluetooth radio. In some cases (in particular, with
the Rococo Palm DK) no code is needed at all to initialize your stack. In other cases, you'll need to write a bit of
code to get your stack initialized because you need to specify baud rates for your RS-232 interface.
Table of Contents
Bluetooth
for Java
For instance,
Listing 4-1 shows the snippet of code that you would need in order to initialize your stack if you were
Introduction
using the Atinav SDK with a RS-232-based Bluetooth device.
Chapter 1
- Introducing Bluetooth
Listing24-1:
Stack Initialization
Code for the Atinav SDK
Chapter
- Bluetooth
1.1
Chapter 3
- Before You Get Started
Chapter
4 com.atinav.bcc.*;
- Understanding the Java Bluetooth API
import
Chapter
... 5 - Bluetooth with J2ME MIDP
Chapter
BCC.setPortName("COM1");
6 - Creating a Bluetooth Print Server with JPS API
BCC.setBaudRate(57600);
Chapter
7 - Java and OBEX
BCC.setConnectable(true);
Chapter
8 - Using a Bluetooth Simulator
BCC.setDiscoverable(DiscoveryAgent.GIAC);
Chapter
9 - Bluetooth Security
... 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Esmertec takes a different approach for stack initialization. Their JSR-82 implementation and stack tends to be
used mostly by wireless device OEMs. Listings 4-2 and 4-3 show the Java classes that would be part of a startup
Appendix C - Java Bluetooth Development on the PalmOS Platform
sequence to initialize the stack for the entire device. After the device has started (which consequently means that
Appendix
1.1 API other Java applications that reside on the device no longer need to include code to
the stackD is- BlipNet
also initialized),
Index
initialize the stack.
Appendix B - javax.obex
List of Figures
Listing
4-2: BluetoothSetup1.java
List
of Tables
List of Listings
List
of Sidebars
import
com.jbed.bluetooth.*;
import java.io.IOException;
public class BluetoothSetup1 {
private static int device;
private static BCC myBCC;
static {
device = DeviceProperties.DEVICE_1;
try {
myBCC = BCC.getInstance();
myBCC.startUp(device);
myBCC.initDriver();
System.out.println("Bluetooth Started");
} catch (IOException exc) {
System.out.println("IOException: " + exc.getMessage());
exc.printStackTrace();
System.out.println("Bluetooth Probably NOT Started ");
}
}
}
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
Apress © 2003 (352 pages)
Listing 4-3: DeviceProperties.java
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
import com.jbed.bluetooth.*;
includes an API overview of the Java library, development of
import com.jbed.bluetooth.HciTransport;
Bluetooth-based services, highlights of security concerns, and
more.
import java.util.Hashtable;
public final class DeviceProperties {
Table of Contents
Bluetooth for Java
public static final int DEFAULT = 0;
Introduction
public static final int ERICSSON = 1;
Chapterpublic
1 - Introducing
staticBluetooth
final int CSR = 2;
Chapterpublic
2 - Bluetooth
1.1 final int SILICONWAVE = 3;
static
Chapterpublic
3 - Before
You Get
Startedint NON_SECURE_MODE_1 = 1;
static
final
Chapterpublic
4 - Understanding
the Java
Bluetooth
API
static final
int
SERVICE_LEVEL_MODE_2
= 2;
Chapterpublic
5 - Bluetooth
static
withfinal
J2ME MIDP
int LINK_LEVEL_MODE_3 = 3;
static
finalPrint
intServer
TRUSTED_DEVICE
= 0;
Chapterpublic
6 - Creating
a Bluetooth
with JPS API
final int UNTRUSTED_DEVICE = 1;
Chapterpublic
7 - Javastatic
and OBEX
static
final
int UNKNOWN_DEVICE = 2;
Chapterpublic
8 - Using
a Bluetooth
Simulator
static
final int AUTHORISATION_REQUIRED = 0x1;
Chapterpublic
9 - Bluetooth
Security
static
finalSystems
int AUTHENTICATION_REQUIRED
= 0x2;
Chapterpublic
10 - Wireless
Embedded
with the Micro BlueTarget
public static final int ENCRYPTION_REQUIRED = 0x4;
static int SERVICE_TABLE_SIZE = 32;
Chapter 12 - Bluetooth and Jini
static int DEVICE_TABLE_SIZE = 8;
Appendix A - javax.bluetooth
public static final int DEVICE_1 = 0;
Appendix B - javax.obex
public static final int DEVICE_2 = 1;
Appendix C - Java Bluetooth Development on the PalmOS Platform
static int NAP_GN_MODE = DEVICE_2;
Appendix
D - BlipNet
API
static
int1.1
PANU_MODE
= DEVICE_1;
Index static int DATA_MTU = 1691;
List of Figures
static int HEADER_LENGTH = 14;
List of Tables
public static int maximumServiceRecordCount = 0xffff;
List of Listings
public static int maximumAttributeByteCount = 0xffff;
List of Sidebars
static int SDP_SERVER_THREADS = 4;
static int SDP_CLIENT_THREADS = 4;
static int BNEP_CHANNELS = 4;
static int MAX_IN_L2CAP_BUFFERS = 32;
static int SDP_THREAD_TIMEOUT = 120000;
static int BLUETOOTH_EVENT_TIMEOUT = 180000;
public static String DEVICE1_NAME = "Little Device1";
public static String DEVICE2_NAME = "Little Device2";
static int DEVICE1_IP = 0x0a110101; // 10.17.01.01
static int DEVICE2_IP = 0x0a110102; // 10.17.01.02
static int NETMASK =
0xFFFFFF00; // 255.255.255.0
static int BROADCAST = 0x0a1101FF; // 10.17.01.255
static int DST_UUID = Sdp.UUID_PANU;
static int SRC_UUID = Sdp.UUID_GN;
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Hashtable ht;
private ExternalSecurityControlEntity myEsce;
String pin = "123";
HciTransport hciTransport;
String device1SerialPort = "COM1";
String device2SerialPort = "COM1";
int
int
int
int
device1BaudRate = 19200; // 38400; //57600; //9600; //115200;
Bluetooth for Java
device2BaudRate
= 19200; // 57600; //38400; //9600; //115200;
ISBN:1590590783
by Bruce Hopkins
and Ranjith Antony
roleSwitch
= HciConnectionTable.REFUSE_ROLE_SWITCH;
Apress
©
2003
(352
pages)
securityMode = SERVICE_LEVEL_MODE_2;
The authors of this text describe how to develop wireless Java
applications using Bluetooth
DeviceProperties(int
device)for
{ a variety of platforms. This
includes an API overview of the Java library, development of
ht = Bluetooth-based
new Hashtable();
services, highlights of security concerns, and
myEsce
= new ESCESample(pin);
more.
// SerialIFHciTransport is a simple UART connection
Table of Contents
if (device == DEVICE_1) {
Bluetooth for Java hciTransport = new SerialIFHciTransport(device1SerialPort,
Introduction
Chapter 1
device1BaudRate);
Chapter 2
- Introducing
Bluetooth
// Human
readable form of the device name
- Bluetooth
ht.put("bluetooth.device.name",
1.1
DEVICE1_NAME);
Chapter 3
elseYou
{ Get Started
-}Before
Chapter 4
hciTransport
new SerialIFHciTransport(device2SerialPort,
- Understanding
the Java =
Bluetooth
API
Chapter 5
- Bluetooth with J2ME MIDP device2BaudRate);
Chapter 6
// aHuman
readable
form
- Creating
Bluetooth
Print Server
with of
JPS the
API device name
Chapter 7
DEVICE2_NAME);
- Java ht.put("bluetooth.device.name",
and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
}
ht.put("bluetooth.api.version", "1.0a");
ht.put("bluetooth.security.mode", Integer.toString(securityMode));
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
ht.put("bluetooth.l2cap.receiveMTU.max", Integer.toString(DATA_MTU));
Chapter 12 - Bluetooth and Jini
ht.put("bluetooth.connected.devices.max", "7");
Appendix A -ht.put("bluetooth.connected.inquiry",
javax.bluetooth
"true");
Appendix B -ht.put("bluetooth.connected.page",
javax.obex
"true");
Appendix C -ht.put("bluetooth.connected.inquiry.scan",
Java Bluetooth Development on the PalmOS Platform
"true");
Appendix D -ht.put("bluetooth.connected.page.scan",
BlipNet 1.1 API
"true");
Index
ht.put("bluetooth.master.switch", "true");
List of Figures
ht.put("bluetooth.sd.trans.max", Integer.toString(SDP_CLIENT_THREADS));
List of Tablesht.put("bluetooth.sd.attr.retrievable.max", "64");
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
List of Listings
testProperties();
List of Sidebars
}
ExternalSecurityControlEntity getEsce() {
return myEsce;
}
private void testProperties() {
int i;
if (hciTransport == null) {
throw new Error("No connection to Host Controller defined");
}
i = getInt("bluetooth.security.mode");
if (i < NON_SECURE_MODE_1 || i > LINK_LEVEL_MODE_3)
throw new Error("bluetooth.security.mode must be NON_SECURE_MODE_1,
SERVICE_LEVEL_MODE_2, or LINK_LEVEL_MODE_3");
if (getInt("bluetooth.l2cap.receiveMTU.max") < 48)
throw new Error("bluetooth.l2cap.receiveMTU.max must be at least" +
Bluetooth for Java
" 48 bytes, default value is 672");
ISBN:1590590783
by Bruce Hopkins and Ranjith Antony
}
Apress
©
2003
(352
pages)
private int getInt(String prop) {
The Integer.parseInt((String)
authors of this text describe how to develop
wireless Java
return
ht.get(prop));
applications
using
Bluetooth
for
a
variety
of
platforms.
This
}
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
}
Table
of we
Contents
So, as
stated earlier, stack initialization must occur before you can do any real work in your Bluetooth
Bluetooth
for (whether
Java
application
you invoke it directly in your code or not).
Introduction
Chapter 1
Introducing Bluetooth
Device- Management
Chapter 2
- Bluetooth 1.1
Chapter
3 - Before
You Get Started and DeviceClass are the classes in the Java Bluetooth specification that
LocalDevice,
RemoteDevice,
Chapter
4 Generic
- Understanding
the Java
Bluetooth
APIto perform device management. These classes allow you to query
form the
Access Profile
and
allow you
some statistical
information
about
your own Bluetooth device (LocalDevice) and also some information on the
Chapter
5 - Bluetooth
with J2ME
MIDP
devices6in -the
area (RemoteDevice).
The DeviceClass
object gives you information about the official class of
Chapter
Creating
a Bluetooth Print Server
with JPS API
device 7(CoD)
as and
defined
in the Bluetooth specification.
Chapter
- Java
OBEX
Chapter 8
- Using a Bluetooth Simulator
javax.bluetooth.LocalDevice
Chapter
9 - Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
There is a famous quote that says, "Know thyself." Well, this class allows you to do exactly that. The
Chapter
11 - Enterprise
Bluetooth
withinformation
the Ericssonabout
BlipNet
LocalDevice
class is
the classApplications
that gives you
yourself, the local Bluetooth device. Being a
Chapter
12
Bluetooth
and
Jini
singleton object, you can only have a single instance of this object in your JVM at a time. Its constructor is
Appendix
A -so
javax.bluetooth
private,
you can instantiate it by using the static getLocalDevice() method:
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
LocalDevice localdevice = LocalDevice.getLocalDevice();
Appendix D - BlipNet 1.1 API
Index
List
public
of Figures
String getBluetoothAddress()
List of Tables
Bluetooth devices have unique addresses, which are quite similar to MAC addresses for network cards on your
PC. This class allows you to find out what your Bluetooth address is with the getBluetoothAddress()
List of Sidebars
method. It returns a 12-character String in the form of something like 00FE3467B092. In most cases, your
Bluetooth radio shows what your address is somewhere externally, but it's nice to have a way to access it
programmatically.
List of Listings
public boolean setDiscoverable(int mode)
In order to allow remote Bluetooth devices to find your device, you need to set the discovery mode of your
Bluetooth device. Table 4-1 contains a list of valid modes and descriptions for the Bluetooth discovery modes.
Table 4-1: Bluetooth Discovery Modes
ACCESS MODE
FULL NAME
DESCRIPTION
VALUE
NOT_DISCOVERABLE
Not Discoverable
Don't allow any devices to discover
your device.
0
GIAC
General/Unlimited
Inquiry Access Code
Allow all devices to discover your
device.
10390323
LIAC
Limited Inquiry Access
Code
A temporary access mode that will
revert back to a previous state after
1 minute.
10390272
One question that might be on your mind is why the values for the access modes are 0, 10390272, and
Bluetooth for Java
10390323. Wouldn't
it be simpler for the values to be something like 0, 1, and 2? Well, the codes for
ISBN:1590590783
by Bruce
Hopkins
and Ranjith
NOT_DISCOVERABLE,
LIAC,
and GIAC
are allAntony
defined in the Bluetooth
Assigned Numbers document from
Apress
©
2003
(352
pages)
http://www.bluetooth.org. Each entry in the document (which has more than just codes for Bluetooth
of this
text
describe how to
develop
wireless
discovery modes)The
hasauthors
a unique
code
in hexadecimal
format.
The
actualJava
codes for LIAC and GIAC as described
applications
using
Bluetooth
for
a
variety
of
platforms.
This and 0x9E8B33 (for GIAC). For your
in the Bluetooth Assigned Numbers document are 0x9E8B00 (for LIAC)
includes an API overview of the Java library, development of
convenience, these
values are available
you as public
constants
in theand
DiscoveryAgent class:
Bluetooth-based
services,tohighlights
of security
concerns,
more.
// javax.bluetooth.DiscoveryAgent.java
...
Table of Contents
public static final int NOT_DISCOVERABLE = 0;
Bluetooth for Java
public static final int LIAC = 0x9E8B00 // 10390272
Introduction
public static final int GIAC = 0x9E8B33 // 10390323;
Chapter 1 - Introducing Bluetooth
...
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
public 5int -getDiscoverable()
Chapter
Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Call this method if you want to know the current discovery mode of your Bluetooth device. This will (obviously)
- Java and OBEX
return an int that's either NOT_DISCOVERABLE,LIAC, or GIAC.
Chapter 7
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
javax.bluetooth.RemoteDevice
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter
TheRemoteDevice
11 - Enterpriseclass
Bluetooth
givesApplications
you accesswith
to athe
single
Ericsson
remote
BlipNet
Bluetooth device in the area. The most common
way to 12
obtain
a reference
to a RemoteDevice is through device discovery, which is covered in the next section.
Chapter
- Bluetooth
and Jini
Here areA two
useful methods that pertain to device management.
Appendix
- javax.bluetooth
Appendix B - javax.obex
public final String getBluetoothAddress()
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix
D - BlipNet
1.1 already
API
As you probably
have
assumed, this method returns to you the 12-character Bluetooth address of the
Index
remote device.
List of Figures
public
String getFriendlyName(boolean alwaysAsk)
List
of Tables
List of Listings
Knowing the Bluetooth address of the RemoteDevice is fine, but it is even better to know the "friendly name" of
that device. The friendly name of a Bluetooth device is something like "Andrew's PDA", "Home Office Printer", or
"Ranjith's MP3 Player".
List of Sidebars
javax.bluetooth.DeviceClass
This class represents the class of device in the Bluetooth specification. A device class is simply a classification of
Bluetooth devices. Why is this class useful? Well, by simply calling the methods of this class, you can determine
what kind of devices are in the area, like computers, laptops, phones, PDAs, access points, etc. The methods
provided to accomplish this task are getMinorDeviceClass() and getMajorDeviceClass(), both of
which return an int.Table 4-2 shows some common major and minor device classes.
Table 4-2: Bluetooth Major and Minor Device Classes [*]
MAJOR
CLASS
MINOR
CLASS
0
MAJOR CLASS
DESCRIPTION
MINOR CLASS DESCRIPTION
Misc. major device
256
0
Computer
Unassigned, misc.
256
4
Computer
Desktop
256
8
Computer
Server
256
12
Bluetooth
for Java Computer
256
by16
Bruce Hopkins and
Ranjith Antony
Computer
Apress © 2003 (352 pages)
256
20authors of this text
Computer
PDA
The
describe how to develop wireless
Java
applications using Bluetooth for a variety of platforms. This
24
Computer
Watch
includes
an API overview
of the Java library, development
of size
Bluetooth-based services, highlights of security concerns, and
0
Phone
Unassigned, misc.
more.
256
512
512
Table
512of Contents
Bluetooth for Java
512
Introduction
Laptop
ISBN:1590590783
Sub-laptop
4
Phone
Cellular
8
Phone
Household cordless
12
Phone
Smart phone
Chapter
512 1
- Introducing
16 Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
LAN/network access point
Fully available
Chapter
768 4
- Understanding
32
the Java Bluetooth
LAN/network
API access point
1–17% utilized
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
768 7
Chapter
96OBEX
- Java and
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
768
768
768
0
64
128
Phone modem
LAN/network access point
17–33% utilized
LAN/network access point
33–50% utilized
LAN/network access point
50–76% utilized
768 10 - Wireless160
LAN/network
access
point
Chapter
Embedded Systems
with the Micro
BlueTarget
67–83% utilized
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
LAN/network access point
83–99% utilized
768 A - javax.bluetooth
224
Appendix
LAN/network access point
100% utilized, no service available
Appendix
1024 B - javax.obex
0
Audio/video device
Unassigned, misc.
768
192
Chapter 12 - Bluetooth and Jini
Appendix C - Java Bluetooth Development on the PalmOS Platform
1024 D - BlipNet 4
Appendix
1.1 API
Audio/video device
Headset (must conform to the
Headset Profile)
8
Audio/video device
Hands-free device
16
Audio/video device
Microphone
44
Audio/video device
VCR
1024
72
Audio/video device
Video game system
1280
64
Computer peripheral
Keyboard
1280
128
Computer peripheral
Mouse, trackball, etc.
1280
12
Computer peripheral
Remote control
1536
16
Imaging device
Display device
1536
32
Imaging device
Camera
1536
64
Imaging device
Scanner
1536
128
Imaging device
Printer
Index
List1024
of Figures
List of Tables
1024
List of Listings
List1024
of Sidebars
7936
Unclassified major device
[*]This
table has a majority of the major and minor device classes listed in the Bluetooth Assigned Numbers
document on the Bluetooth Web site: http://www.bluetooth.org.
So, that's about all it takes to perform device management with the Java Bluetooth APIs. Now, let's take a look at
the concept in Bluetooth that allows you to discover other Bluetooth devices: device discovery.
Device Discovery
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
Your Bluetooth device has no idea of what other Bluetooth devices are in the area. Perhaps there are laptops,
Apress © 2003 (352 pages)
desktops, printers, mobile phones, or PDAs in the area. Who knows? The possibilities are endless. In order to
The authors of this text describe how to develop wireless Java
find out, your Bluetooth
device will use the device discovery classes that are provided in the Java Bluetooth API to
applications using Bluetooth for a variety of platforms. This
see what's out there.
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
Which Bluetooth more.
devices should use device discovery? Well, if you are planning to use a peer-to-peer application
in Bluetooth, like two PDAs in a chat session, then either device would use device discovery to find the other
device. If you are planning to use a client-server type application, like printing from a lap-top to a printer, then the
Table
clientofisContents
most likely to perform device discovery. It doesn't make sense for the printer to constantly look for
Bluetooth
for Java
devices that
want to print something.
Introduction
Now, let's
a look atBluetooth
the two classes needed in order for your Bluetooth device to discover remote Bluetooth
Chapter
1 -take
Introducing
devices2in -the
area: DiscoveryAgent
and DiscoveryListener.
Chapter
Bluetooth
1.1
Chapter 3
- Before You Get Started
javax.bluetooth.DiscoveryAgent
- Understanding the Java Bluetooth API
Chapter 4
Chapter
5 - Bluetooth
with J2MEobject,
MIDP the most logical next step for device discovery is to instantiate the
After getting
a LocalDevice
Chapter
6
Creating
a
Bluetooth
Server with
JPS API
DiscoveryAgent object. You Print
accomplish
this task
by calling LocalDevice.getDiscoveryAgent().
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
LocalDevice
localdevice = LocalDevice.getLocalDevice();
Chapter
9 - Bluetoothdiscoveryagent
Security
DiscoveryAgent
= localdevice.getDiscoveryAgent();
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
When you
to discover
other Bluetooth devices in the area, DiscoveryAgent gives you two methods to
Chapter
12 -want
Bluetooth
and Jini
work with:
and retrieveDevices().
Appendix
A -startInquiry()
javax.bluetooth
Appendix B - javax.obex
public boolean startInquiry(int accessCode, DiscoveryListener listener)
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix
- BlipNet
1.1 API your DiscoveryAgent, you use this method to make your Bluetooth device search
After youD have
instantiated
Index
for other devices in the area. The length of the inquiry is totally dependent upon the implementation of the Java
List
Bluetooth
of Figures
specification. The accessCode can be one of the following DiscoveryAgent constants:
NOT_DISCOVERABLE,
LIAC, or GIAC. You must also pass a reference to a class that implements the
List
of Tables
DiscoveryListener
interface. When new devices are discovered, event callbacks are passed back to this
List
of Listings
object.
This method will return trueif the device successfully went into discovery mode. The
List
of Sidebars
startInquiry() method is the only way to perform device discovery without blocking the current thread.
public RemoteDevice[] retrieveDevices(int option)
Use the retrieveDevices() method to get a list of RemoteDevice objects that were found by previous
inquiries. The option field has either the value of 0 for CACHEDor 1 for PREKNOWN. For your convenience,
CACHED and PREKNOWN are also defined as constants in the DiscoveryAgent class. Unlike the
startInquiry() method, this method blocks the calling thread until it returns. CACHED and PREKNOWN
devices are determined by the BCC.
Note For the most part, a CACHED device is simply a Blue-tooth device that was found from a recent inquiry.
Of course, the definition of "recent" is implementation dependent. A PREKNOWN device is a level above
aCACHED device and is one that you frequently communicate with.
For example, let's say that you own a Bluetooth-enabled PDA. If you have exchanged business cards with
another PDA within an hour, an implementation may classify that PDA as CACHED. However, if you own a printer
at home, and you print to it often from the PDA, then an implementation may classify the printer as PREKNOWN.
Please note that the retrieveDevices() method does not perform a true inquiry for Bluetooth devices, and
subsequently, devices found from this method may not be in the area. However, this really isn't a problem,
because the purpose of this method is to quickly give you the references to the devices that you want to connect
to. The startInquiry() method will guarantee that the device is in the area, but it may take a considerable
amount of time in order to find the device that you want.
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
javax.bluetooth.DiscoveryListener
ISBN:1590590783
Apress © 2003 (352 pages)
If you've worked with
event handling
in Java,
thenhow
thetoconcept
listeners
is not new to you. Like all listeners,
The authors
of this text
describe
developofwireless
Java
applications
Bluetooth
for a method
variety ofthat
platforms.
DiscoveryListener
is anusing
interface
that has
is calledThis
by the JVM when the desired event
includes
an API overview
the Java library,
of
occurs. If you want
to be informed
when aofBluetooth
device development
is found by DiscoveryAgent.startInquiry(),
Bluetooth-based services, highlights of security concerns, and
then your class needs
to implement the DiscoveryListener interface. Whenever a Bluetooth device is found,
more.
the method deviceDiscovered() is called.
public
void deviceDiscovered(RemoteDevice btDevice, DeviceClass cod)
Table
of Contents
Bluetooth for Java
As stated in the preceding section, this method is called by the JVM when a remote Bluetooth device is found
from an inquiry. The RemoteDevice object is a reference to the Bluetooth device found from the inquiry. The
Chapter
1 - Introducing
Bluetooth
DeviceClass
object (which
tells you if the remote device is a phone, a PC, a PDA, etc.) is also provided when
Chapter
2 - Bluetooth
this method
is called. 1.1
See Table 4-2 for common device classes and their numbers.
Introduction
Chapter 3
- Before You Get Started
Note
deviceDiscovered()
method
Chapter
4 The
- Understanding
the Java Bluetooth
APImay be called more than once for the same Bluetooth device in
vicinity. with J2ME MIDP
Chapter 5 the
- Bluetooth
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Now that you know all the semantics about discovering devices, let's discuss how to find what services (if any)
- Java and OBEX
that these devices offer.
Chapter 7
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Service Discovery
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
After you have located devices in the area, it would be really nice to see what services those devices offer. Of
course, you can always inspect the DeviceClass object, but that may only reveal half the picture. Let's say that
Appendix A - javax.bluetooth
you want to print a text file. Obviously, if the DeviceClass indicates that the major device class of the
Appendix
B - javax.obex
RemoteDevice
is a printer, then you're all set. But what if the major device class is a computer? Would it come
Appendix
C - Java
Bluetooth
Development
on thethat
PalmOS
Platform
to mind that
you can
also print
to a computer
is acting
as a print server?
Chapter 12 - Bluetooth and Jini
Appendix D - BlipNet 1.1 API
IndexCROSSList ofREFERENCE
Figures
This is actually a good segue for Chapter 6. In Chapter 6, you'll learn how to convert your
desktop computer into a wireless print server.
List of Tables
The service discovery-related classes in the Java Bluetooth specification implement the Service Discovery
Application Profile. The Service Discovery Application Profile, in turn, uses the Service Discovery Protocol (SDP)
List of Sidebars
layer in your Bluetooth stack to find services on remote Bluetooth devices.
List of Listings
CROSSREFERENCE
SeeChapter 2 for detailed descriptions of profiles and layers in Bluetooth.
The following classes are provided in the Java Bluetooth specification for service discovery: DiscoveryAgent,
DiscoveryListener,ServiceRecord,DataElement, and UUID. You'll also interact (indirectly) with the
SDDB whenever you want to discover services on a remote Bluetooth device.
The Service Discovery Database
The Service Discovery Database (SDDB) is the central repository for all service records, but it's not a database in
the sense of Oracle 9i, Sybase, or even MS Access. It's simply a collection of service records (and no, we don't
mean a Java Collections object). The JSR-82 implementation is free to implement the SDDB in any form, so
when a ServiceRecord object is stored in the SDDB, it doesn't necessarily mean that the JVM serialized the
ServiceRecord object and stored it in a data store. If a particular JSR-82 implementation does not store
service records in the SDDB as Java objects, then it must convert them into ServiceRecord objects when a
client performs a search for services and a match is found.
Figures 4-1 through 4-4 present graphical depictions of the SDDB, ServiceRecord,DataElement, and UUID
objects in regard to how they all work together for service discovery.
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Figure 4-1: Service records in the SDDB
Chapter
Understanding
the Java
Bluetooth
API
As you 4can- see
in Figure 4-1,
a service
record
is an individual entry in the SDDB (Service Discovery Database).
Chapter 5 - Bluetooth with J2ME MIDP
Entries6in service
records
are called
Chapter
- Creating
a Bluetooth
Print attributes.
Server withAttributes
JPS API consist of an ID and value. See Figure 4-2 for an
illustration.
Chapter
7 - Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Figure 4-2: An individual attribute of a service record
Index
List
of Figures
Attribute
IDs are 16-bit unsigned integers (0x000-0xFFFF). In a ServiceRecord object, attribute values are
List
of Tables
stored
as DataElement objects as shown in Figure 4-3.
List of Listings
List of Sidebars
Figure 4-3: An illustration of a service record attribute
DataElements can be created from the following Java types: int,boolean,UUID, and Enumeration (see
Figure 4-4).
Figure 4-4: DataElements
Figure 4-5 wraps it all up by showing the process of service discovery for a PDA that wants to use the services of
a Bluetooth keyboard. A successful service discovery will occur only if there is a match in the UUID of a service
Bluetooth
for Java
record in the SDDB
of the RemoteDevice.
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
Table of Contents
Bluetooth for Java
Introduction
Figure 4-5: The service discovery process for a PDA that wants to use the services of a Bluetooth keyboard
Chapter 1 - Introducing Bluetooth
Now, let's
at the service
discovery-related classes in detail.
Chapter
2 -look
Bluetooth
1.1
Chapter 3
- Before You Get Started
Chapter 5
- Bluetooth with J2ME MIDP
javax.bluetooth.UUID
Chapter
4 - Understanding the Java Bluetooth API
TheUUID class is simply a class that uniquely identifies services in the Bluetooth protocol (UUID stands for
- Creating a Bluetooth Print Server with JPS API
Universal Unique Identifier). Let's say that you have a Bluetooth client device that supports L2CAP connections. If
Chapter 7 - Java and OBEX
you want to send a message to a Bluetooth server device, just perform service discovery with the UUID of
Chapter
8 which
- Using
Bluetooth
Simulator
0x0100,
is athe
UUID for
L2CAP. If you have a Bluetooth-enabled PDA, and you want to send your
Chapter
9
Bluetooth
Security
business card (.vcf) to other Bluetooth-enabled devices, then you'll perform service discovery with a UUID of
Chapter
10 which
- Wireless
with
the Micro
0x1105,
is theEmbedded
UUID for Systems
the OBEX
Object
PushBlueTarget
Profile. Table 4-3 lists a sample of UUIDs for Bluetooth
Chapter
11
Enterprise
Bluetooth
Applications
with
the
Ericsson
BlipNet
protocol layers and Table 4-4 lists UUIDs for Bluetooth services
and their corresponding Bluetooth profile. For
Chapter
12
Bluetooth
and
Jini
instance, Headset and HeadsetAudioGateway are both distinct services that are a part of the Headset Profile.
Therefore,
service has its own UUID, 0x1108 and 0x1112, respectively. Some profiles, like the FAX
Appendix
A - each
javax.bluetooth
Profile,
only
have
one service: FAX (which has a UUID of 0x1111). A more exhaustive list of UUID values for
Appendix B - javax.obex
protocolsC and
profile
services
can be seen
in the
Bluetooth
Assigned Numbers document.
Appendix
- Java
Bluetooth
Development
on the
PalmOS
Platform
Chapter 6
Appendix D - BlipNet 1.1 API
Table 4-3: Common UUID Values for Bluetooth Protocol Layers
Index
ListPROTOCOL
of Figures
UUID (DECIMAL)
UUID (HEXADECIMAL)
ListSDP
of Listings
1
0x0001
List of Sidebars
RFCOMM
3
0x0003
L2CAP
256
0x0100
HTTP
12
0x000C
FTP
10
0x000A
TCP
4
0x0004
IP
9
0x0009
UDP
2
0x0002
BNEP
15
0x000F
OBEX
8
0x0008
TCS-BIN
5
0x0005
List of Tables
Table 4-4: Common UUID Values for Bluetooth Profiles
PROFILE
Serial Port
SERVICE
NAME
Bluetooth for
Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
SerialPort
UUID
(DECIMAL)
ISBN:1590590783
4353
The authors of this text describe how to develop wireless Java
applications using
Bluetooth for a variety of platforms.
Dial-up Networking
LANAccessUsingPPP
4354 This
includes an API overview of the Java library, development of
Bluetooth-based
services, highlights of security concerns,
and
Dial-up Networking
DialupNetworking
4355
more.
UUID
(HEXADECIMAL)
0x1101
0x1102
0x1103
Object Push
OBEXObjectPush
4357
0x1105
Object
Push
Table
of Contents
OBEXFileTransfer
4358
0x1106
CordlessTelephony
4361
0x1109
Audio/Video
Control Bluetooth
A/V_RemoteControl
Chapter
1 - Introducing
4366
0x110E
4368
0x1110
4369
0x1111
4360
0x1108
4370
0x1112
4382
0x111E
Bluetooth
forTelephony
Java
Cordless
Introduction
Profile2 - Bluetooth 1.1
Chapter
Chapter
3 - Before You Get Started
Intercom
Intercom
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Fax
Fax
Chapter
6 Access
- Creating a Bluetooth
Print Server with JPS API
Generic
Headset
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Generic Access
HeadsetAudioGateway
Chapter
9 - Bluetooth SecurityHandsfree
Handsfree
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Handsfree
HandsfreeAudioGateway
4383
0x111F
4386
0x1122
4387
0x1123
Hard Copy
Cable
HardCopyCableReplacement
Appendix
C - Java
Bluetooth Development
on the PalmOS Platform 4389
0x1125
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter
Basic 12
Printing
- Bluetooth and Jini BasicPrinting
Appendix A - javax.bluetooth
Basic Printing
Appendix B - javax.obex
PrintingStatus
Replacement
Appendix
D - BlipNet 1.1 API
Index
Hard Copy Cable
HCR_Print
4390
0x1126
HCR_Scan
4391
0x1127
Human Interface
Device
HumanInterfaceDeviceService
4388
0x1124
Generic Networking
n/a
4609
0x1201
ListReplacement
of Figures
List of Tables
Copy Cable
ListHard
of Listings
ListReplacement
of Sidebars
Now, let's take a look at the constructors for UUID.
public UUID(long uuidValue)
This is pretty cut and dry—it constructs a UUID object from a long.
public UUID(String uuidValue, boolean shortUUID)
This method allows you to construct a UUID from a String representation of a UUID. If shortUUID is set to
true, then a short UUID is returned (one that is made up of 16 bits instead of 128 bits).
Note When using this method, be sure not to include the "0x" prefix in front of the String when constructing
this object.
javax.bluetooth.DiscoveryAgent
Hey, wait a minute, didn't we use this class for device discovery? Well, that's why the authors of the Java
Bluetooth specification named this class DiscoveryAgent, because they intended this class to be used for both
Bluetooth
for
device and service
discovery.
InJava
order to find services on remote devices, you'll use either selectService() or
ISBN:1590590783
by
Bruce
Hopkins
and Ranjith Antony
searchServices().
Apress © 2003 (352 pages)
public int searchServices(int[]
attrSet,
UUID[]how
uuidSet,
RemoteDevice
btDev, DiscoveryListener
The authors of this
text describe
to develop
wireless Java
discListener) applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based
of on
security
concerns,
This method allows
you to searchservices,
for a listhighlights
of services
a single
remoteand
Bluetooth device. The attrSet[]
more.
parameter must be populated with an array of integers that correspond to attributes that you want to see when
the services match the UUIDs. The UUID[] parameter is the list of UUIDs of services that you want to look for.
RemoteDevice
Table
of Contents is the reference to the remote device that you want to search for services. You must also
provide
Bluetooth an
forobject
Java that will implement the DiscoveryListener interface in order to receive event callbacks
when
services
that match your UUID criteria are discovered. This method returns an int that is the transaction
Introduction
ID.
You
can
later
use the transaction ID to cancel this search if you need to.
Chapter 1 - Introducing Bluetooth
Chapter
- Bluetooth
1.1
public 2String
selectService(UUID
uuid, int security, boolean master)
Chapter 3 - Before You Get Started
This method
also allows you
search
for services,
but it has a slight twist that makes it different from
Chapter
4 - Understanding
theto
Java
Bluetooth
API
searchServices().
This
method
Chapter
5 - Bluetooth with
J2ME
MIDPaccepts neither a DiscoveryListener nor a RemoteDevice object. By
using this
can perform
searchwith
for JPS
a particular
UUID that is available on ANY device in the area. If
Chapter
6 method,
- Creatingyou
a Bluetooth
PrintaServer
API
there is7a match,
thenOBEX
this method returns a String that will be used in the Connector.open() method in
Chapter
- Java and
order to8 establish
connection
to that device. Be sure to notice that this method only allows you to search on a
Chapter
- Using aa Bluetooth
Simulator
singleUUID and not multiple UUIDs, as in searchServices().
Chapter 9
- Bluetooth Security
Chapter
10 - Wireless
Systems
with in
the
Micro
BlueTarget
Unfortunately,
there Embedded
is no method
available
the
JSR-82
specification that will allow you to discover every
Chapter
11
Enterprise
Bluetooth
Applications
with
the
Ericsson
BlipNet
service offered by remote devices. By using either searchServices()
or selectService(), you need to
Chapter
12
Bluetooth
and
Jini
know the UUID of the service that you're looking for before you attempt to perform a search.
Appendix A - javax.bluetooth
NoteB You
may be able to discover every service on a remote device if that device has all of its services
Appendix
- javax.obex
with Development
a BrowseGroupList
attribute
in the service record. If not, then you're out of luck.
Appendix C categorized
- Java Bluetooth
on the PalmOS
Platform
the Bluetooth
Appendix D See
- BlipNet
1.1 API specification for more details on how to browse for services.
Index
javax.bluetooth.DiscoveryListener
List of Figures
List
Tables
Ourofgood
ol' buddy DiscoveryListener, which helped us to discover devices, comes back to help us discover
List
of
Listings
services on remote Bluetooth devices.
List of Sidebars
public void servicesDiscovered(int transID, ServiceRecord[] servRecord)
If you use the DiscoveryAgent.searchServices() method (which accepts a DiscoveryListener), then
this method is called by the JVM when services are discovered on the remote device. The transaction ID and an
array of ServiceRecord objects are provided to this method. With a ServiceRecord in hand, you can do
plenty of things, but you would most likely want to connect to the RemoteDevice where this ServiceRecord
originated:
String connectionURL = servRecord[i].getConnectionURL(0, false);
javax.bluetooth.ServiceRecord
ServiceRecord objects are representations of individual entries in the SDDB. As you may remember, the
SDDB is the central repository of service records for a Bluetooth device.
javax.bluetooth.DataElement
As we continue to break down the anatomy of service discovery, let's now examine the DataElement object.
EachServiceRecord object in the SDDB is made up of attributes. All attributes are stored as DataElement
objects. A DataElement object can be from any of the following:
Integers
Booleans
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
Strings
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
UUIDs
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
Sequences of
the preceding values
more.
Be sure to take another look at Figures 4-1 through 4-4 if you're still in the dark about the relationship between
Table
the SDDB,
of Contents
ServiceRecord,DataElement, and UUID objects.
Bluetooth for Java
Introduction
Service Registration
Chapter 1
- Introducing Bluetooth
Chapter
- Bluetooth
1.1 device can use service discovery on a Bluetooth server device, the server needs to
Before 2a Bluetooth
client
Chapter
register3its-services
Before You
internally.
Get Started
That process is called service registration. This section discusses what's involved in
service4registration
for a Bluetooth
device, and
Chapter
- Understanding
the Java Bluetooth
APIwe'll also give you a rundown of the classes needed to
accomplish
this.
Chapter
5 - Bluetooth
with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Note In a peer-to-peer application, like a file transfer or chat application, be sure to remember that any
- Java and OBEX
device can act as the client or the server, so you'll need to incorporate that functionality into your code
Chapter 8 - Using a Bluetooth Simulator
in order to handle both scenarios of service discovery and service registration.
Chapter 7
Chapter 9
- Bluetooth Security
Chapter
- Wireless
Systems
with the
Micro
BlueTarget
Here's 10
a scenario
of Embedded
what's involved
in getting
your
service
registered and stored in the SDDB:
Chapter
11
Enterprise
Bluetooth
Applications
with
the
Ericsson
BlipNet to a StreamConnectionNotifier object.
1. CallConnector.open() and cast the resulting connection
Chapter Connector.open()
12 - Bluetooth and Jini creates a new ServiceRecord and sets some attributes.
Appendix A - javax.bluetooth
2. Use
LocalDevice object and the StreamConnectionNotifier to obtain the ServiceRecord
Appendix
B - the
javax.obex
byDevelopment
the system. on the PalmOS Platform
Appendixthat
C - was
Javacreated
Bluetooth
Appendix D - BlipNet 1.1 API
3. Add or modify the attributes in the ServiceRecord (optional).
Index
List of
4. Figures
Use the StreamConnectionNotifier to call acceptAndOpen() and wait for Bluetooth clients to
List of Tables
discover this service and connect.
List of Listings
5.Sidebars
The system creates a service record in the SDDB. Wait until a client connects. When the server is ready to
List of
exit, call close() on the StreamConnectionNotifier.
6. The system removes the service record from the SDDB.
StreamConnectionNotifier and Connector both come from the javax.microedition.io package of
the J2ME platform. Listing 4-4 is a snippet of code that achieves the service registration process.
Listing 4-4: The Service Registration Process
...
// let's name our variables
StreamConnectionNotifier notifier = null;
StreamConnection sconn = null;
LocalDevice localdevice = null;
ServiceRecord servicerecord = null;
// step #1
// the String url will already be defined with the correct url parameters
notifier = (StreamConnectionNotifier)Connector.open(url);
// step #2
// we will get the LocalDevice if not already done
localdevice = LocalDevice.getLocalDevice();
for Java
servicerecordBluetooth
= localdevice.getRecord(notifier);
ISBN:1590590783
by
Bruce
Hopkins
and Ranjith Antony
// step #3 is optional
Apress © 2003 (352 pages)
// step #4 The authors of this text describe how to develop wireless Java
usingthe
Bluetooth
for a variety
of platforms.
// this step applications
will block
current
thread
until a This
client responds
includes an API overview of the Java library, development of
notifier.acceptAndOpen();
Bluetooth-based services, highlights of security concerns, and
// the service
record is now in the SDDB
more.
// step #5
Table
of Contents
// just
wait...
Bluetooth
for Java
// assume
the client has connected and you are ready to exit
Introduction
Chapter
1 #6
- Introducing Bluetooth
//step
Chapter
// this
2 -causes
Bluetooththe
1.1 service record to be removed from the SDDB
notifier.close();
Chapter
3 - Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
And that's -all
that you need to do service registration in Bluetooth. The next step is communication.
Java and OBEX
Chapter 7
Chapter 8
- Using a Bluetooth Simulator
Communication
- Bluetooth Security
Chapter 9
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Okay, Bluetooth is a communication protocol, so how do you communicate with it? Well, the official Java
Bluetooth API gives you three ways to send and receive data, but for right now we'll cover only two of them:
Chapter 12 - Bluetooth and Jini
RFCOMM and L2CAP.
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Appendix A - javax.bluetooth
Appendix B - javax.obex
RFCOMM Connections
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix
D - BlipNet
1.1 API
As you may
remember
from Figure 2-9, the most common Bluetooth profiles use the Serial Port Profile as a
Index
foundational layer.
List of Figures
Note RFCOMM is the protocol layer that the Serial Port Profile uses in order to communicate, but these two
items are almost always used synonymously.
List of Tables
List of Listings
List
of Sidebars
Sessions
and Connections
Before we continue, there's a little more terminology to introduce here: sessions and connections. You can only
have a single session between two Bluetooth devices. This limitation isn't a big deal, per se, because the
definition of a session is simply one or more connections shared between two devices. You can also relate a
Bluetooth session in the same way that sessions are created and used on the Web. When a Web server is
communicating to a Web client, there is only one session, although there are numerous connections. Now, a
Bluetooth device can have multiple sessions only if each session is linked to a different device. This also applies
on the Web; powerful application servers have the capability to create multiple sessions and keep them in
memory, but each session is linked to a different client.
Server Connections with the Serial Port Profile
Listing 4-5 demonstrates what is needed to open connections on a Bluetooth device that will act as a server.
Listing 4-5: Opening Connections on a Bluetooth Server
...
// let's name our variables
StreamConnectionNotifier notifier = null;
StreamConnection con = null;
LocalDevice localdevice = null;
for Java = null;
ServiceRecordBluetooth
servicerecord
by
Bruce
Hopkins
and Ranjith Antony
InputStream input;
Apress
©
2003
(352
pages)
OutputStream output;
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications
Bluetooth
for a variety
of platforms.
This
// let's create
a URLusing
that
contains
a UUID
that
includes an API overview of the Java library, development of
// has a veryBluetooth-based
low chanceservices,
of conflicting
with anything
highlights of security
concerns, and
String url = more.
"btspp://localhost:00112233445566778899AABBCCDDEEFF;name=serialconn";
// let's open the connection with the URL and cast it into
a StreamConnectionNotifier
Table
of Contents
notifier
= (StreamConnectionNotifier)Connector.open(url);
Bluetooth for Java
Introduction
// block the current thread until a client responds
Chapter
- Introducing Bluetooth
con =1 notifier.acceptAndOpen();
Chapter
// the
2 client
- Bluetooth
has
1.1 responded, so open some streams
input3 = -con.openInputStream();
Chapter
Before You Get Started
output
con.openOutputStream();
Chapter
4 =- Understanding
the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
// now
thea streams
areServer
open,
and receive some data
Chapter
6 that
- Creating
Bluetooth Print
withsend
JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
For the most part, this is just about the same code used in service registration, and in fact, it is; service
registration and server communication are both accomplished using the same lines of code. Here are a few
Chapter
11 -need
Enterprise
Bluetooth
Applications
with url
the Ericsson
BlipNet
items that
to be pointed
out.
The String
begins with
btspp://localhost:, which is required if
Chapter
12
Bluetooth
and
Jini
you're going to use the Bluetooth Serial Port Profile. Next comes the UUID part of the URL, which is
Appendix
A - javax.bluetooth
00112233445566778899AABBCCDDEEFF.
This is simply a custom UUID that was made up for this service; any
Appendix
B - javax.obex
string that's
128 bits long could have been used. Finally, we have name=serialconn in the URL String. We
Appendix
C - left
Javathis
Bluetooth
PalmOS
Platform
could have
part off,Development
but we wanton
ourthe
custom
service
to have a name, so the actual service record in the
Appendix
D - the
BlipNet
1.1 API
SDDB has
following
entry:
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Index
List
of Figures
ServiceName
= serialconn
List of Tables
List of Listings
The
has also assigned a channel identifier to this service. The client must provide the channel
List
of implementation
Sidebars
number along with other parameters in order to connect to a server.
Client Connections with the Serial Port Profile
Establishing a connection with the Serial Port Profile for a J2ME client is simple because the paradigm hasn't
changed. You simply call Connector.open().
StreamConnection con = (StreamConnection)Connector.open(url);
You obtain the url String that is needed to connect to the device from the ServiceRecord object that you
get from service discovery. Here's a bit more code that will show you how a Serial Port Profile client makes a
connection to a Serial Port Profile server:
String connectionURL = serviceRecord.getConnectionURL(0, false);
StreamConnection con = (StreamConnection)Connector.open(connectionURL);
What does a Serial Port Profile client connection URL look like? If the address of the server is 0001234567AB,
then the String that the SPP client would use would look something like this:
btspp://0001234567AB:3
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The 3 at the end The
of the
URL String
is the
channel
thatwireless
the server
authors
of this text
describe
hownumber
to develop
Javaassigned to this service when this
applications
using Bluetooth for a variety of platforms. This
service was added
to the SDDB.
L2CAP
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
Connections
more.
Unlike RFCOMM connections, which are stream oriented, L2CAP connections are packet oriented. Before we
cover
to create L2CAP connections, we'll briefly cover a new concept called Maximum Transmission Unit
Table
ofhow
Contents
(MTU).
We'll
also cover the classes needed in order to create L2CAP connections: L2CAPConnection and
Bluetooth for Java
L2CAPConnectionNotifier.
Introduction
Chapter 1
Introducing Bluetooth
Maximum-Transmission
Unit
Chapter 2
- Bluetooth 1.1
Chapter
Because
3 of
- Before
the factYou
thatGet
theStarted
L2CAP layer sends data in packets, the official Java Bluetooth API gives you the
flexibility
how large
packets
canAPI
be. The default MTU is 672 bytes, but you can attempt to negotiate
Chapter
4 to- control
Understanding
the the
Java
Bluetooth
a larger5 MTU
in your connection
URL strings. Here's why we say "attempt": If the client indicates that it can
Chapter
- Bluetooth
with J2ME MIDP
receive6data
in packet
sizes of 10MB,
and the
server
is only capable of sending data at 1kB, then there's no real
Chapter
- Creating
a Bluetooth
Print Server
with
JPS API
problem;
client'll
get its data in 1kB packets. Now on the other hand, if the server indicates that it's sending
Chapter
7 the
- Java
and OBEX
data in 810MB-size
the client is only capable of handling 1kB packets, then the transmission will fail
Chapter
- Using apackets,
Bluetoothand
Simulator
horribly. - Bluetooth Security
Chapter 9
Chapter
Wireless
Embedded
Systems
with
theyou
Micro
In order10to-find
out the
largest packet
size
that
canBlueTarget
receive from a L2CAP connection, just run the following
Chapter
11
Enterprise
Bluetooth
Applications
with
the
Ericsson BlipNet
piece of code:
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
LocalDevice local = LocalDevice.getLocalDevice();
Appendix
- javax.obex
StringB receiveMTUmax
= local.getProperty("bluetooth.l2cap.receiveMTU.max");
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
L2CAP Server Connections
Index
List of Figures
Following is the code that a L2CAP server uses to open a connection to a client:
List of Tables
List of Listings
L2CAPConnectionNotifier
notifier = (L2CAPConnectionNotifier).Connector.open(url);
List
of Sidebars
L2CAPConnection con = (L2CAPConnection)notifier.acceptAndOpen();
As you can see, it is not much different from the standard StreamConnectionNotifier and Connection
used for RFCOMM server connections.
L2CAP Client Connections
Now here's the code that a client would use in order to establish an L2CAP connection with a server:
L2CAPConnection = (L2CAPConnection)Connector.open(url);
Once again, it's pretty straightforward.
More on MTUs
Now, let's look at MTUs one more time, in conjunction with opening connections. For instance, if the server code
looked like this:
String url =
"btl2cap://localhost:00112233445566778899AABBCCDDEEFF;ReceiveMTU=1024;TransmitMTU
=1024";
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
The connection String
Apress © for
2003the
(352
client,
pages)on the other hand, would look something like this:
The authors of this text describe how to develop wireless Java
using Bluetooth for a variety of platforms. This
String url = applications
"btl2cap://2E345BB78902:1055;ReceiveMTU=4096;TransmitMTU=512";
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
As you can see, the server is proposing to send data in packet sizes of 1024 bytes. Since the client is able to
receive data packets four times that size, the negotiated connection will have a packet data size of the lowest
Table
of Contents
common
denominator: 1024. On the other hand, the client wants to send its data in packets of 512 bytes. The
Bluetooth
Java
server is for
able
to handle that packet size with no problem at all, and the negotiated connection will be 512 byte
Introduction
packets.
Chapter 1
- Introducing Bluetooth
Chapter 3
- Before You Get Started
Now, let's take a brief look at the two classes used in order to create L2CAP connections and some of their
Chapter 2 - Bluetooth 1.1
methods.
Chapter
4 - Understanding the Java Bluetooth API
javax.bluetooth.L2CAPConnection
Chapter 5
- Bluetooth with J2ME MIDP
This interface
is just aa Bluetooth
subclass of
theServer
Connection
interface, and you use it in the same manner. The following
Chapter
6 - Creating
Print
with JPS API
methods
found
L2CAPConnection that are not found in Connection:
Chapter
7 are
- Java
andinOBEX
Chapter 8
- Using a Bluetooth Simulator
public int getReceiveMTU(): This method gets the negotiated ReceiveMTU value from the
- Bluetooth Security
connection.
Chapter 9
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter
public
11 - Enterprise
int getTransmitMTU():
Bluetooth ApplicationsThis
withmethod
the Ericsson
gets BlipNet
the negotiated TransmitMTU value from the
Chapter
connection.
12 - Bluetooth and Jini
Appendix A - javax.bluetooth
public boolean ready(): This method will return true if there is any data ready to be read. If this
method returns true, then a call to receive() will not block the main thread.
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix
D - BlipNet
API
public
int 1.1
receive(byte[]
inBuf): Regardless of the ReceiveMTU between your device and the
Index remote device, you can set the size of inBuf to be whatever you want it to be. If the size of inBuf is greater
List ofthan
Figures
or equal to the ReceiveMTU, then you won't lose any data during a transmission. If the size of inBuf[]
List ofisTables
smaller than the size of ReceiveMTU, then inBuf[] will be filled with data for the incoming packet, but
List ofthe
Listings
remainder of the data will be lost.
List of Sidebars
public void send(byte[] data): Use this method to send data to a remote Bluetooth device via the
L2CAP protocol. You're free to send any size packet that you want, but if you exceed the TransmitMTU
size, then the excess data will be discarded.
L2CAP vs. RFCOMM
So now that you know how to send data between Bluetooth clients and servers using both L2CAP and RFCOMM,
we bet you're wondering about typical usage scenarios for these connections. In other words, why would anyone
use RFCOMM instead of L2CAP to send data or vice versa? Well, RFCOMM is also known as the virtual serial
port communication protocol. An ideal way to use RFCOMM is in situations when you would replace a serial
cable. For instance, if you were a developer for a GPS manufacturer, and your duty was to make one of their
units Bluetooth enabled, then RFCOMM would be a likely choice in this scenario. Why? The GPS unit will always
have a constant stream of information that needs to be processed, rendered, calculated, etc. So, collect the data
from your stream and plot those coordinates on the screen.
On the other hand, L2CAP is great for handling packet data. L2CAP can easily be used (and actually is) as a
data multiplexer. You can read data from the connection, and based upon a header in the packet, you can route
that data to different methods, threads, and classes in your application.
Summary
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
This chapter gaveApress
you a©formal
introduction
to the official Java Bluetooth APIs. You should be aware of all
2003 (352
pages)
the basic components
of
a
Bluetooth
application,
as well
as howwireless
to implement
The authors of this text describe how
to develop
Java them using the classes and
interfaces of the official
Java
Bluetooth
API.
This
chapter
also
discussed
applications using Bluetooth for a variety of platforms. Thisthe importance and the roles that
includes
an API
overview
Java
library,applications.
development of
the Bluetooth Control
Center
(BCC)
playsofinthe
your
wireless
Bluetooth-based services, highlights of security concerns, and
more. showed you how a Bluetooth application works by its components. In the next
Essentially, this chapter
chapter, we'll look at a full working example of a Java Bluetooth application using the Atinav Java
Bluetooth SDK.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
for Java
Chapter Bluetooth
5: Bluetooth
with J2MEISBN:1590590783
MIDP
by Bruce Hopkins and Ranjith Antony
Apress ©a2003
(352
pages)
Now that we've covered
lot of
the
foundational material, let's start creating some Java Bluetooth
The
authors
of
this
textyour
describe
howexample
to develop
wireless
Java
applications. This chapter will give you
first full
of a
Java Bluetooth
application, but before
applications using Bluetooth for a variety of platforms. This
we dive right in, we're going to give a brief primer on J2ME and the Mobile Information Device Profile
includes an API overview of the Java library, development of
(MIDP). Afterwards,
we're going to
examine
two sample
applications:
Stealth
Bluetooth-based
services,
highlights
of security
concerns,
and Mode and the Piconet
Browser.
more.
Note If you've already developed a MIDlet, or if you have a working knowledge of J2ME, then feel free
Table of Contents
to skip down to the example code in the sections "Stealth Mode Example" and "Piconet Browser
Bluetooth for
Example."
Java
Introduction
- Introducing Bluetooth
J2ME Overview
Chapter 1
Chapter 2
- Bluetooth 1.1
Under the
termGet
of Started
J2ME, there are two configurations that correspond to two classes of devices.
Chapter
3 -general
Before You
The connected
device configuration
(CDC) isAPI
a classification for devices that have a network connection,
Chapter
4 - Understanding
the Java Bluetooth
but have
processing
than a typical desktop computer. Set-top boxes, appliances, smart
Chapter
5 less
- Bluetooth
withpower
J2ME MIDP
phones,
high-end
PDAs fit into
category.
TheAPI
connected limited device configuration (CLDC)
Chapter
6 and
- Creating
a Bluetooth
Printthis
Server
with JPS
classifies
devices; they are capable of making a network connection, but it isn't robust or
Chapter
7 many
- Javamobile
and OBEX
dedicated.-CLDC
devices typically don't have a lot of processing power, and many mobile phones, twoUsing a Bluetooth Simulator
way pagers, and some PDAs fit into this category.
Chapter 8
Chapter 9
- Bluetooth Security
Chapter
- Wireless
Embedded
Systems
A J2ME10Profile
is a software
layer
that iswith
builtthe
onMicro
top ofBlueTarget
a configuration (not to be confused with a Bluetooth
Chapter
11
Enterprise
Bluetooth
Applications
with
the
BlipNet
profile). Configurations typically encompass a broad Ericsson
classification
of devices, and profiles help to narrow
Chapter
12
Bluetooth
and
Jini
the scope, while providing more functionality to the configuration. Figure 5-1 shows the J2ME world, and
Appendix
A - javax.bluetooth
the relationship
between configurations and profiles.
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Figure 5-1: J2ME Profiles and configurations
for Java Device Profile
The Mobile Bluetooth
Information
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
Now, let's take a Apress
look at©what
is (by
far) the most widely used J2ME Profile: Mobile Information Device
2003 (352
pages)
Profile (MIDP). If The
you authors
have a Java-enabled
mobile
phone,
then it's
most Java
likely a MIDP device. As stated
of this text describe
how
to develop
wireless
earlier, the J2MEapplications
Profiles extend
the
functionality
of
a
configuration.
The
using Bluetooth for a variety of platforms. ThisCLDC provides the following
an in
API
overview
of the
Javaapplications
library, development
packages for the includes
developer
order
to create
Java
for smallof
devices:
Bluetooth-based services, highlights of security concerns, and
java.lang more.
(basic core language classes)
java.io (networking classes)
Table of Contents
Bluetooth
java.util
for Java (utility classes)
Introduction
javax.microedition.io
(more networking classes)
- Introducing Bluetooth
Chapter 1
Chapter 2
- Bluetooth 1.1
Note These
are not the full J2SE versions of java.lang,java.io, and java.util APIs. The
- Before You Get Started
CLDC
contains a subset of these packages that's optimized for micro devices.
Chapter 3
Chapter 4
- Understanding the Java Bluetooth API
Chapter
The MIDP
5 -adds
Bluetooth
thesewith
additional
J2ME MIDP
packages for mobile devices:
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
javax.microedition.lcdui (user interface classes)
Chapter
8 - Using a Bluetooth Simulator (core MIDlet classes)
javax.microedition.midlet
Chapter 9 - Bluetooth Security
javax.microedition.rms
(datawith
persistence
Chapter
10 - Wireless Embedded Systems
the Micro classes)
BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
According to the MIDP specification, these are the qualifications for a MIDP 1.0 device:
Chapter 12 - Bluetooth and Jini
Appendix
A - javax.bluetooth
A minimum
screen resolution of 96 54 pixels.
Appendix B - javax.obex
A minimum
128kB nonvolatile
memory
for the MIDP
implementation.
Appendix
C - Java of
Bluetooth
Development
on the PalmOS
Platform
Appendix D - BlipNet 1.1 API
Index
A minimum of 32kB volatile memory for JVM heap space.
List ofAFigures
minimum of 8kB nonvolatile memory for applications to store persistent data.
List of Tables
type of input mechanism.
List ofSome
Listings
List of Sidebars
Support for network connectivity.
The OS must provide minimal scheduling, exception handling, and interrupt processing.
The OS must support writing of bitmapped graphics to display.
The OS must be able to accept the input and pass it on to the JVM.
The MIDP 2.0 specification raises the bar by requiring at least 256kB of non-volatile memory, and 128kB
of memory for the Java heap space. However, the MIDP 2.0 specification also brings along more
functionality for wireless applications, including the following:
Secure networking with HTTPS
Push applications with the javax.microedition.io.PushRegistry class
Standardized serial port communications
Wireless application deployment with Over-the-Air provisioning (OTA)
Better gaming applications with the javax.microedition.lcdui.game package
Developing MIDlets
What is a MIDlet? A MIDlet is a Java application that runs on a mobile device and uses the Mobile
Bluetooth for Java
Information Device Profile. MIDlets can be created by extending the
ISBN:1590590783
by Bruce Hopkins and Ranjithclass.
Antony
javax.microedition.midlet.MIDlet
A MIDlet has
three states in its life cycle: active,
Apress
©
2003
(352
pages)
paused, and destroyed. Those three states correspond to three methods:startApp(),pauseApp(),
The authors
this MIDlets
text describe
how to
developin
wireless
anddestroyApp().
One or of
more
packaged
together
a JAR Java
file constitute a MIDlet suite.
applications using Bluetooth for a variety of platforms. This
Software on the mobile
device
(called
the
application
manager)
is
responsible
for loading, running, and
includes an API overview of the Java library, development of
destroying the MIDlet.
Bluetooth-based services, highlights of security concerns, and
more.
The skeletal structure of a typical MIDlet looks like this:
Table of Contents
import javax.microedition.midlet.MIDlet;
Bluetooth
Java MyApplcation extends MIDlet
public for
class
Introduction
{
Chapter 1
- Introducing
publicBluetooth
MyApplication()
Chapter 2
- Bluetooth
1.1
{
Chapter 3
- Before
} You Get Started
Chapter 4
- Understanding
public void
the Java
startApp()
Bluetooth API
Chapter 5
{
- Bluetooth
with J2ME MIDP
Chapter 6
}
- Creating
a Bluetooth Print Server with JPS API
Chapter 7
void pauseApp()
- Javapublic
and OBEX
Chapter 8
{ a Bluetooth Simulator
- Using
Chapter 9
}
- Bluetooth
Security
public void destroyApp(boolean unconditional)
{
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
}
Chapter 12 - Bluetooth and Jini
}
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
IndexNote Sun has created a very handy tool for MIDlet development called the J2ME Wireless Toolkit.
The tool comes bundled with an emulator and can package, compile, preverify, and run CLDC
List of Figures
and MIDP applications. The examples in this chapter use this tool, and it is available free from
List of Tables
the Wireless Java Web site (http://wireless.java.sun.com/).
List of Listings
List of Sidebars
Using the MIDP User Interface Components
The MIDP UI is logically composed of two APIs: high-level and low-level. The high-level API is primarily
designed for business applications, and it gives you objects like List,TextBox,ChoiceGroup, and
DateField. This API includes a high level of abstraction because you can't define the visual appearance
(i.e., shape, color, font, etc.) of those components. When using the high-level UI components, you won't
have direct control of the navigation or scrolling, or have direct access to the input device (you can process
input, but you won't have direct access to it). All of these items are handled by the MIDP implementation
and are device dependent. This abstraction allows the same MIDlet to run on a Blackberry pager as well
as on a Palm PDA.
Thelow-level API, on the other hand, is designed for applications that need precise placement and control
of graphic elements, as well as access to low-level input events. The low-level API is well suited for
gaming or entertainment-based applications.
Using the RMS for Persistent Storage
So, how do you store persistent data on a micro device? If you think about it, a mobile phone probably
wouldn't have a file system in order to store its data. It's really overkill for such a small device that keeps
names and phones numbers to have a file system just for data storage. Being aware of this, the J2ME
architects have developed a viable alternative to storing data persistently called the RecordManagement
System (RMS). The javax.microedition.rms package contains all the functionality that will enable
your classes to read, write, and sort data in the RMS.
Bluetooth for Java
ISBN:1590590783
by Bruce Hopkins
and Ranjith
The RMS is a record-oriented
database
storedAntony
in the nonvolatile
memory of the mobile device. Since it is
Apress
© 2003
(352referred
pages)
record oriented, the
RMS
is also
to as a flatfile system, where the data is stored in a series of
rows in a table, much
like theofdata
in a conventional
database.
Each
The authors
this stored
text describe
how to develop
wireless
Javarow will have a unique
applications
using of
Bluetooth
a variety
of platforms.
This5-2.
identifier. A logical
representation
a recordfor
store
is illustrated
in Figure
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Figure
A logical representation
of an
RMS record store
Chapter
4 - 5-2:
Understanding
the Java Bluetooth
API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter
6 class
- Creating
Bluetooth
Print Server with JPS API
The main
in thea RMS
is javax.microedition.rms.RecordStore.
This class contains the
Chapter
7
Java
and
OBEX
methods for creating, updating, deleting, and querying a record store. A few interfaces are also provided is
Chapter
8 - Using
Bluetooth
Simulator
this package,
andathey
help you
whenever you need to enumerate, compare, and filter the data stored
Chapter
9 -record
Bluetooth
Security
inside the
store.
The RMS also includes a listener interface called
javax.microedition.rms.RecordListener.
you associate this listener with a record store,
Chapter
10 - Wireless Embedded Systems with the MicroWhen
BlueTarget
the interface
reports events
that Applications
correspondwith
to inserts,
updates,
and deletes of data that are in the record
Chapter
11 - Enterprise
Bluetooth
the Ericsson
BlipNet
store. 12 - Bluetooth and Jini
Chapter
Appendix A - javax.bluetooth
Performing I/O with the GCF
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
In order Dfor- J2ME
to perform any networking or I/O, they must use the java.io and
Appendix
BlipNetapplications
1.1 API
javax.microedition.io packages. These packages together form the Generic Connection
Index
Framework
List
of Figures(GFC).
List of Tables
The general philosophy behind the GCF is to create a framework to abstract the communication process
List
of Listings
through
a single class called Connector. You can then use Connector to create any connection like file
List
of
SidebarsTCP/IP socket connections, HTTP connections, etc. In order to open a connection, just use
I/O streams,
theopen method:
Connector.open("protocol:address:parameters");
If a user wants to open an HTTP connection, the connection URL will look like this:
Connector.open("http://mydomain.com");
Working with the Example Code
Before you try out any of the examples in this book, it is recommended that you first get your JSR-82
implementation on your development environment installed and configured. If you don't have your
development environment set up, then here's a checklist of the things that you need to do:
Select a JSR-82 implementation that supports your OS. You can find an updated listing of JSR-82
implementations at the companion Web site for this book: http://www.javabluetooth.com.
Select the Bluetooth hardware that is supported by your JSR-82 implementation.
Bluetooth for Java
by configure
Bruce Hopkins
Ranjith Antony
Install and
your and
development
environment.
ISBN:1590590783
Apress © 2003 (352 pages)
Try out the
programs
thatdescribe
are included
your wireless
JSR-82 Java
implementation.
Thedemo
authors
of this text
how towith
develop
applications using Bluetooth for a variety of platforms. This
Determine
what stack
(if any)
is used
in the demo
includes
an APIinitialization
overview ofcode
the Java
library,
development
of programs.
Bluetooth-based services, highlights of security concerns, and
The documentation
more. for your JSR-82 implementation really should point out what you need to do in
order to initialize your stack. But just in case they don't, a dead ringer would be a class that you need
to import that's not part of the javax.bluetooth or javax.obex packages (see Appendices A and
Table B
offor
Contents
an exhaustive list). In some cases, your stack initialization code will also be setting the baud rate
Bluetooth
for Java
for your
Bluetooth device.
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth
for Java
Stealth Mode
Example
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
The Stealth ModeApress
example
is (352
a simple
© 2003
pages) program that illustrates the concepts of stack initialization, device
management, and
device
discovery.
When
the program
starts, itwireless
looks for
remote Bluetooth devices as
The authors of this text
describe
how to develop
Java
shown in Figure 5-3.
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Figure 5-3: The application starts, and is now looking for remote Bluetooth devices.
Once it finds another device, it goes into nondiscoverable mode, as shown in Figure 5-4.
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List ofFigure
Figures5-4: After a remote device is found, we now go into stealth mode (i.e., nondiscoverable).
List of Tables
List of Listings
In this example, we're using the J2ME Wireless Toolkit configured with the Atinav Bluetooth SDK. The
Bluetooth device that we're using is a TDK USB module, as shown in Figure 5-5.
List of Sidebars
Figure 5-5: The TDK USB Bluetooth device using a CSR Bluetooth radio
The code for this example is shown in Listings 5-1 and 5-2.
Listing 5-1: Stealth.java
import
import
import
import
javax.microedition.midlet.*;
javax.microedition.lcdui.*;
javax.bluetooth.*;
java.io.*;
import java.util.*;
Bluetooth for Java
import javax.microedition.io.*;
by Bruce Hopkins and Ranjith Antony
import com.atinav.bcc.*;
ISBN:1590590783
Apress © 2003 (352 pages)
this text describe
how used
to develop
/* The Timer The
andauthors
the of
BeamTsk
class is
to wireless
createJava
the beam of
applications
using
Bluetooth
for
a
variety
of
platforms.
* 3 concentric circles blinking. It has no purpose This
except visual enhancement.
includes an API overview of the Java library, development of
*/
Bluetooth-based services, highlights of security concerns, and
public class more.
Stealth extends MIDlet {
private Display display;
private GUI canvas;
Table ofprivate
Contents Timer tm;
Bluetooth
for Java BeamTsk tsk;
private
Introduction
private String dev;
Chapterprivate
1 - Introducing
Bluetooth device[];
RemoteDevice
Chapter 2
- Bluetooth 1.1
Stealth()
Chapterpublic
3 - Before
You Get Started
Chapter{4
- Understanding the Java Bluetooth API
Chapter 5
-display=Display.getDisplay(this);
Bluetooth with J2ME MIDP
Chapter 6
GUI(this);
-canvas=new
Creating a Bluetooth
Print Server with JPS API
Chapter 7
-tm=new
Java and Timer();
OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
tsk=new BeamTsk(canvas);
tm.schedule(tsk,1000,1000);
}
protected void startApp()
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
{
Chapter 12 - Bluetooth and Jini
display.setCurrent(canvas);
Appendix
} A - javax.bluetooth
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Appendix B - javax.obex
Appendix
C - Java Bluetooth
Development on the PalmOS Platform
protected
void pauseApp()
Appendix
{ D - BlipNet 1.1 API
Index }
List of Figures
public void destroyApp(boolean unconditional) {
List of Tables
}
List of Listings
public void exitStealth()
List of Sidebars
{
destroyApp(true);
notifyDestroyed();
}
public void exitTimer(){
tm.cancel();
tsk.cancel() ;
}
}
class GUI extends Canvas implements CommandListener{
private Command exitCommand;
private Image img=null;
private Image imgArc=null;
private Stealth midlet;
public int i=0; // used for creating the beam
public int count=0; // used to create the blinking
public boolean cancel=false;
int x=30;
int y=30;
int wd=5;
int ht=10;
public GUI(Stealth midlet){
Bluetooth for Java
this.midlet=midlet;
ISBN:1590590783
by Bruce HopkinsCommand("Exit",Command.EXIT,1);
and Ranjith Antony
exitCommand=new
Apress
©
2003
(352
pages)
addCommand(exitCommand);
The authors of this text describe how to develop wireless Java
setCommandListener(this);
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
try {Bluetooth-based services, highlights of security concerns, and
img=Image.createImage("/phone.png");
more.
}
catch (java.io.IOException e){
Table of Contents System.err.println("Unnable to locate or read image (.png) file");
Bluetooth for}Java
Introduction try{
Chapter 1 - Introducing
Bluetooth
BCC.setPortName("COM1");
Chapter 2 - Bluetooth
BCC.setBaudRate(57600);
1.1
BCC.setConnectable(false);
Chapter 3 - Before
You Get Started
LocalDevice
localDevice
Chapter 4 - Understanding
the Java
Bluetooth API = LocalDevice.getLocalDevice();
discoveryAgent
Chapter 5 - Bluetooth
with J2ME MIDP = localDevice.getDiscoveryAgent();
device
= new
RemoteDevice[10];
Chapter 6 - Creating
a Bluetooth
Print
Server with JPS API
Chapter 7 - Java discoveryAgent.startInquiry(DiscoveryAgent.GIAC,this);
and OBEX
}catch(BluetoothStateException btstateex)
Chapter 8 - Using a Bluetooth Simulator
{
Chapter 9 - Bluetooth Security
btstateex.printStackTrace();
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
}
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
}
Appendixpublic
A - javax.bluetooth
void deviceDiscovered(RemoteDevice btDevice, DeviceClass cod)
Appendix B - javax.obex
{
Appendix C - Java/*
Bluetooth
Development
on the PalmOS
The method
is fired
every Platform
time a device is discovered.
Appendix D - BlipNet 1.1
API
* The inquiry is cancelled after the first device is discovered.
Index
List of Figures
List of Tables
*/
BCC.setDiscoverable(DiscoveryAgent.NOT_DISCOVERABLE);
cancelInquiry(discoveryAgent);
List of Listings }
public void inquiryCompleted(int discType)
List of Sidebars
{
cancel=true;
this.notify();
}
/**
* paint
*/
public void paint(Graphics g) {
if (i==0){
// Used to clear the portion of the screen
g.setColor(255,255,255);
g.fillRect(25,10,50,70);
}
else {
// draw the image of phone at given
// coordinates at the top left of the screen
g.drawImage(img,10,30,Graphics.LEFT|Graphics.TOP);
// draw a string at the bottom left
g.drawString("Me",10,45+img.getHeight(),Graphics.LEFT|
Graphics.BOTTOM);
Bluetooth for Java
if (!cancel){
ISBN:1590590783
by Bruce
Ranjithcoordinates
Antony
// draw
an Hopkins
arc atand
given
Apress
©
2003
(352
pages)
g.drawArc(x,y,wd,ht,270,180);
The authors of this text describe how to develop wireless Java
}
applications using Bluetooth for a variety of platforms. This
else{
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
g.drawImage(img,90,30,Graphics.RIGHT|Graphics.TOP);
more.
g.drawString("I am in Stealth Mode",2,100,Graphics.LEFT|
Graphics.BOTTOM);
Table of Contents
try {
Bluetooth forimg=Image.createImage("/phonegray.png");
Java
Introduction }catch (Exception e){e.printStackTrace();}
Chapter 1 -g.drawImage(img,10,30,Graphics.LEFT|Graphics.TOP);
Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
;
-midlet.exitTimer()
Before You Get Started
Chapter}4
- Understanding the Java Bluetooth API
} 5
Chapter
- Bluetooth with J2ME MIDP
}
Chapter
6
- Creating a Bluetooth Print Server with JPS API
public
c, Displayable s) {
Chapter
7 void
- Java commandAction(Command
and OBEX
Chapter 8
- Using a Bluetooth Simulator
if (c == exitCommand)
- Bluetooth Security
midlet.exitStealth();
Chapter 9
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
}
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
}
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix
C - Java
Bluetooth Development on the PalmOS Platform
Listing 5-2:
BeamTsk.java
Appendix D - BlipNet 1.1 API
Index
import java.util.*;
public class BeamTsk extends TimerTask {
List of Figures
List of Tables
List of Listings
private GUI canvas;
List of Sidebars
/** Creates a new instance of BeamTsk */
public BeamTsk(GUI canvas) {
this.canvas=canvas;
}
public void run() {
//if (canvas.count>5)
//
canvas.cancel=true;
if (canvas.i<3)
canvas.i=canvas.i+1;
else
canvas.i=0;
switch (canvas.i){
case 1:{
canvas.x=30;
canvas.y=30;
canvas.ht=10;
break;
}
case 2 :{
canvas.x=canvas.x+5;
canvas.y=canvas.y-3;
canvas.ht=canvas.ht+6;
Bluetooth
break; for Java
ISBN:1590590783
} by Bruce Hopkins and Ranjith Antony
Apress
©
2003
(352
pages)
case 3:{
The
authors of this text describe how to develop wireless Java
canvas.x=canvas.x+5;
applications
using Bluetooth for a variety of platforms. This
canvas.y=canvas.y-3;
includes an API overview of the Java library, development of
canvas.ht=canvas.ht+6;
Bluetooth-based
services, highlights of security concerns, and
canvas.count=canvas.count+1;
more.
break;
}
Table }
of Contents
Bluetooth
for Java
canvas.repaint();
Introduction
}
Chapter
1
}
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
BluetoothExample
for Java
Piconet Browser
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
The Piconet Browser
is ©
a 2003
handy
Apress
(352utility
pages)that demonstrates all the concepts presented in the last example and
also includes theThe
functionality
of
service
discovery.
It'storeally
something
authors of this text describe
how
develop
wireless that
Javayou would want to keep with
you at all times, so
after
you
get
this
example
working,
be
sure
to
load
it
on your mobile phone or PDA.
applications using Bluetooth for a variety of platforms. This
an you
API can
overview
of theBluetooth
Java library,
development
Using the Piconetincludes
Browser,
see what
devices
are in theofvicinity. After the list is displayed,
Bluetooth-based
services,
highlights
of security
concerns,
you can select a particular
Bluetooth
device
to see what
services
it offers.and
more.
The algorithm for this example is pretty simple. First, the MIDlet creates a form and displays it with buttons
labeled Search and Exit (see Figure 5-6).
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Figure 5-6: The initial screen for the Piconet Browser application
After pressing the Search button, the application performs a device discovery, and displays the search
results (see Figure 5-7).
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
Figure 5-7: The Piconet Browser displays a list of Bluetooth devices in the area.
List of Tables
List of Listings
After
you select a Bluetooth device, the application will display the services that it offers (see Figure 5-8).
List
of Sidebars
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List ofFigure
Figures5-8: The Piconet Browser now displays the services offered by the remote device.
List of Tables
List of Listings
Listing
5-3 shows the code for the Piconet Browser.
List
of Sidebars
Listing 5-3: PiconetMIDlet.java.
import
import
import
import
import
import
javax.microedition.midlet.*;
javax.microedition.lcdui.*;
javax.bluetooth.*;
java.io.*;
javax.microedition.io.*;
com.atinav.bcc.*;
public class PiconetMIDlet extends javax.microedition.midlet.MIDlet implements
CommandListener,DiscoveryListener{
private LocalDevice localDevice=null;
private RemoteDevice device=null;
private DiscoveryAgent discoveryAgent = null;
private Command exitCommand; // The exit command
private Command srchCommand; //The search command
private Command backCommand;
private Display display;
private Form frm;
// The display for this MIDlet
private List deviceLst;
Bluetooth
for Java
private List
ServiceLst;
ISBN:1590590783
by Bruce Hopkins and Ranjith Antony
Apress
©
2003
(352
pages)
int count = 0;
The authors of this text describe how to develop wireless Java
applications using
private String[]
dev Bluetooth
= null;for a variety of platforms. This
includes an API overview of the Java library, development of
private Image
img[] services,
=null; highlights of security concerns, and
Bluetooth-based
private String[]
services=null;
more.
public void startApp() {
Table of Contents
display = Display.getDisplay(this);
Bluetooth forexitCommand
Java
= new Command("Exit", Command.EXIT, 1);
Introduction srchCommand=new Command("Search",Command.SCREEN,1);
Chapter 1
Chapter 2
-backCommand=
Introducing Bluetooth
new Command("Back",Command.BACK,1);
-frm=new
Bluetooth 1.1
Form("Piconet Browser");
Chapter 3
-frm.addCommand(srchCommand);
Before You Get Started
Chapter 4
-frm.addCommand(exitCommand);
Understanding the Java Bluetooth API
Chapter 5
-frm.setCommandListener(this);
Bluetooth with J2ME MIDP
Chapter 6
-display.setCurrent(frm);
Creating a Bluetooth Print Server with JPS API
Chapter}7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
public void pauseApp() {
- Bluetooth Security
}
Chapter 9
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
public void destroyApp(boolean unconditional) {
}
Appendix
A - javax.bluetooth
public
void commandAction(Command c, Displayable s) {
Chapter 12 - Bluetooth and Jini
Appendix B - javax.obex
Appendix C -if
Java(c
Bluetooth
Development on{the PalmOS Platform
== exitCommand)
Appendix D - BlipNet
1.1
API
destroyApp(false);
Index
notifyDestroyed();
List of Figures
}
List of Tablesif (c == srchCommand) {
try{
BCC.setPortName("COM1");
BCC.setBaudRate(57600);
BCC.setConnectable(false);
BCC.setDiscoverable(DiscoveryAgent.NOT_DISCOVERABLE);
LocalDevice localDevice = LocalDevice.getLocalDevice();
//device = new RemoteDevice[10];
discoveryAgent = localDevice.getDiscoveryAgent();
discoveryAgent.startInquiry(DiscoveryAgent.GIAC,this);
}catch(BluetoothStateException btstateex)
{
btstateex.printStackTrace();
}
List of Listings
List of Sidebars
try{
deviceLst=new List("Devices",List.IMPLICIT,dev,img);
deviceLst.addCommand(exitCommand);
srchCommand=null;
srchCommand=new Command("Refresh",Command.SCREEN,1);
deviceLst.addCommand(srchCommand);
deviceLst.setCommandListener(this);
display.setCurrent(deviceLst);
System.out.println(deviceLst.getSelectedIndex());
Bluetooth
for Javae){e.printStackTrace();}
}catch
(Exception
ISBN:1590590783
by
Bruce
Hopkins
and Ranjith Antony
}
Apress
©
2003
(352
pages)
if (c==List.SELECT_COMMAND){
The authors
of this text describe how to develop wireless Java
int
index=deviceLst.getSelectedIndex();
applications
using
Bluetoothfor
for adevice[index]
variety of platforms. This
//do service search
includes an API overview of the Java library, development of
int[]
attrSetservices,
= {100};
Bluetooth-based
highlights of security concerns, and
UUID[]
more. uuids = new UUID[1];
uuids[0] = new UUID("9856",true);
services=null;
Table of Contents
int transId=discoveryAgent.searchServices(attrSet,uuids,
Bluetooth for Java
device[i],PiconetMIDlet);
Introduction
Chapter 1
Chapter 2
- Introducing
Bluetooth
ServiceLst=new
List("Service",List.IMPLICIT);
- Bluetooth
for (int
1.1
k=0;k<services.length;k++)
Chapter 3
- Before YouServiceLst.append(services[k],null);
Get Started
Chapter 4
ServiceLst.addCommand(backCommand);
- Understanding
the Java Bluetooth API
Chapter 5
ServiceLst.setCommandListener(this);
- Bluetooth
with J2ME MIDP
Chapter 6
display.setCurrent(ServiceLst);
- Creating
a Bluetooth Print Server with JPS API
Chapter 7
-}Java and OBEX
if (c == backCommand) {
display.setCurrent(deviceLst);
Chapter 9 - Bluetooth Security
}
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
}
Chapter 8
- Using a Bluetooth Simulator
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix
A - javax.bluetooth
public
void deviceDiscovered(RemoteDevice btDevice, DeviceClass cod)
Appendix
B
- javax.obex
{
Appendix C
Bluetooth
Development
on the PalmOS
/*- Java
Store
the device
address
in thePlatform
array which will be
Appendix D *- BlipNet
1.1
API
used to create the device list.
Index
* the getBluetoothAddress() returns the Bluetooth address as a string.
List of Figures
*/
device[count]=btDevice;
List of Tables
//Check the type of device so that the appropriate image can be selected
List of Listings
try{
List of Sidebars
if (cod.getMinorDeviceClass()==0x04)
img[count]=Image.createImage("/phone.png");
else if (cod.getMinorDeviceClass()==0x0C)
img[count]={Image.createImage("/laptop.png")};
else img[count]={Image.createImage("/misc.png")};
} catch (Exception e){e.printStackTrace();}
count++;
}
public void servicesDiscovered(int transID,ServiceRecord[] servRecords)
{
for(int i=0;i<servRecords.length;i++)
services[i]=servRecords[i].getAttributeValue(0x0100);
synchronized(this){
this.notify();
}
}
public void serviceSearchCompleted(int transID, int respCode)
{if(respCode==SERVICE_SEARCH_ERROR){
Bluetooth for Java
System.out.println("\nSERVICE_SEARCH_ERROR\n");
ISBN:1590590783
by Bruce Hopkins and Ranjith Antony
}
Apress
©
2003
(352
pages)
if(respCode==SERVICE_SEARCH_COMPLETED){
The authors of this text describe how to develop wireless Java
// System.out.println("\nSERVICE_SEARCH_COMPLETED\n");
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
}
Bluetooth-based services, highlights of security concerns, and
if(respCode==SERVICE_SEARCH_TERMINATED){
more.
System.out.println("\n SERVICE_SEARCH_TERMINATED\n");
}
Tableif(respCode
of Contents
== SERVICE_SEARCH_NO_RECORDS){
Bluetooth forservices[0]="
Java
None";
Introduction
synchronized(this){
Chapter 1 - Introducing Bluetooth
this.notify();
Chapter 2 - Bluetooth
}
1.1
SERVICE_SEARCH_NO_RECORDS\n");
Chapter 3 System.out.println("\n
- Before You Get Started
} 4 - Understanding the Java Bluetooth API
Chapter
if(respCode
Chapter
5 - Bluetooth==
withSERVICE_SEARCH_DEVICE_NOT_REACHABLE)
J2ME MIDP
SERVICE_SEARCH_DEVICE_NOT_REACHABLE\n");
Chapter 6 System.out.println("\n
- Creating a Bluetooth Print Server
with JPS API
} 7 - Java and OBEX
Chapter
Chapter 8
- Using a Bluetooth Simulator
public void inquiryCompleted(int discType)
- Bluetooth Security
{
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
this.notify();
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
}
Chapter 9
Chapter 12 - Bluetooth and Jini
Appendix
A - javax.bluetooth
}
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
In order
to port these examples to another JSR-82 SDK, just remove the import statement:
List
of Figures
List of Tables
List
of Listings
import
com.atinav.bcc.*;
List of Sidebars
and the stack initialization code:
BCC.setPortName("COM1");
BCC.setBaudRate(57600);
BCC.setConnectable(false);
BCC.setDiscoverable(DiscoveryAgent.NOT_DISCOVERABLE);
Your code is now 100 percent JSR-82 compatible. The next step is to follow the instructions of your JSR-82
implementation on how to initialize your stack. In some cases, as with the Rococo implementation, no
additional code is needed at all.
Summary
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
This chapter gaveApress
you your
first
fully
working example of a wireless application using Java and Bluetooth.
© 2003
(352
pages)
We gave you twoThe
examples,
and
together
they demonstrated
stack
initialization,
device management,
authors of this text describe
how to develop
wireless
Java
device discovery,applications
and serviceusing
discovery.
The
Piconet
Browser
is
a
good
utility
program
that you'll probably
Bluetooth for a variety of platforms. This
antimes.
API overview of the Java library, development of
want to keep withincludes
you at all
Bluetooth-based services, highlights of security concerns, and
more.
If any concepts are
unclear to you, right now would be a good time to review them, because in the next
chapter we'll demonstrate communication by printing, and we'll also take a look at the JPS API.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
for Java
Chapter Bluetooth
6: Creating
a BluetoothISBN:1590590783
Print Server with JPS
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
API
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.many (if not all) printers will include a Bluetooth interface. You'll be able to walk up to
In the years to come,
Highlights
any printer, download its drivers, and print to it using the Hardcopy Cable Replacement Profile.
Unfortunately, that's not the case today. A large majority of the printers on the market today do not have a
Table of Contents
Bluetooth interface, and in order to make them Bluetooth enabled, you need to add a Bluetooth printer
Bluetooth for Java
adapter, like the one shown in Figure 6-1.
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter
12 - 6-1:
Bluetooth
and use
Jini the 3Com Wireless Bluetooth Printer Adapter in order to make a traditional
Figure
You can
Appendix
- javax.bluetooth
(i.e.,Anon-Bluetooth)
printer Bluetooth enabled.
Appendix B - javax.obex
Let's sayCthat
youBluetooth
have a mobile
Bluetooth
device
that Platform
is capable of printing (for instance, a laptop or
Appendix
- Java
Development
on the
PalmOS
PDA). Whether
you're
business user or a home user, you most likely would want to print to the printers
Appendix
D - BlipNet
1.1 a
API
that you already have connected to your desktop computer. If you're a consumer with one or two printers
Index
in your home, then you may need to buy a few printer adapters for the printers that are not Bluetooth
enabled (which is somewhat practical, but can get really expensive if you have more printers). On the
List of Tables
other hand, if you're a business user, you probably have a whole network of printers available at your
List of Listings
disposal. Buying a printer adapter for each and every printer in a corporate environment really doesn't
List of Sidebars
make a lot of sense.
List of Figures
This chapter gives you a handy utility that will turn your desktop computer into a Bluetooth print server
using the Java Print Service (JPS) API. If your desktop computer already has the drivers and mappings
that are necessary to print to your printers, why not utilize it? Your mobile device can submit print jobs to
your desktop computer, and your desktop will automatically print the file to one of your printers using JPS
(see Figure 6-2).
Figure 6-2: Using the handy utility provided in this chapter, you can turn your desktop into a Bluetooth
print server.
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
JPS Overview
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
The relationship between
a printer
and its client is pretty simple. The client needs to answer two questions:
Apress © 2003
(352 pages)
The authors of this text describe how to develop wireless Java
What to print?
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
How to print it?
Bluetooth-based services, highlights of security concerns, and
more.
In turn, the printer also needs to answer two questions:
What's
the status of the printer itself?
Table of
Contents
Bluetooth for Java
What's the status of the print job?
Introduction
Chapter
1 - Introducing
Bluetooth
The exchange
of information
between the printer and its client takes place by means of three entities
Chapter
2 JPS
- Bluetooth
1.1
within the
architecture:
documents,attributes, and events.
Chapter 3
- Before You Get Started
Note
consists
of the following packages: javax.print,
Chapter
4 Consequently,
- Understandingthe
theJPS
JavaAPI
Bluetooth
API
javax.print.attribute.standard, and
Chapter 5 javax.print.attribute,
- Bluetooth with J2ME MIDP
Chapter 6 javax.print.event.
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
- Using a Bluetooth Simulator
Documents
Chapter 8
Chapter 9
- Bluetooth Security
By far, 10
the-most
important
pieceSystems
of data with
that the
will Micro
be exchanged
Chapter
Wireless
Embedded
BlueTargetbetween the client and the printer is the
document
In JPSBluetooth
terminology,
the term
document
is used
in a generic sense; it only refers to the
Chapter
11 -itself.
Enterprise
Applications
with
the Ericsson
BlipNet
item to 12
be -printed.
A document
Chapter
Bluetooth
and Jini could be an image, a style sheet, an actual text document, or anything
that's printable. The classes that will enable you to create a document are included in the javax.print
package. This package also has functionality that will allow you to create documents of well-known data
Appendix B - javax.obex
formats such as HTML, PostScript, GIF, and JPEG.
Appendix A - javax.bluetooth
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Attributes
Index
List of Figures
Of course, you'll have to do more than just give the printer a document; you also need to tell the printer
what exactly needs to be done to the document. Print attributes will indicate to the printer things such as
List of Listings
the size of the paper required, how many copies to print, the number of pages, and duplexing. The
List
of Sidebars
packages
javax.print.attribute and javax.print.attribute.standard allow you to create
these attributes.
List of Tables
Events
The JPS event model is pretty simple; after you've submitted a print job to the printer, the printer will inform
you of its status through events. You can be notified of things like the printer's on/off status, the number of
pages printed, and so on. The javax.print.event package deals with creating and handling these
events.
Bluetooth
for Application
Java
A Step-by-Step
JPS
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
Let's walk through
a simple
JPS
Along the way, we'll identify major classes and interfaces that
Apress
© 2003
(352application.
pages)
are a part of the JPS
API.
Now,
in
order
to
create
a Java
Print Service
you need to do the
The authors of this text describe how
to develop
wirelessapplication,
Java
following:
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
1. Identify theBluetooth-based
format of the data
to be printed (i.e., GIF, JPEG, PDF, HTML, etc.).
services, highlights of security concerns, and
more.
2. Search for a print service that supports your data format.
a print job and submit it.
Table3.of Create
Contents
Bluetooth for Java
4. Listen for status updates (optional).
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Printers and Print Services
If you're
new toYou
theGet
JPS,
you may say to yourself, "I know what a printer is, but what's a print service?"
Chapter
3 - Before
Started
In JPS,
a javax.print.PrintService
Chapter
4 - Understanding
the Java Bluetooth APIobject is a logical representation of an actual printer. So
instead
of printingwith
to aJ2ME
printer,
you'll print to a print service.
Chapter
5 - Bluetooth
MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Identifying
theSecurity
Format
- Bluetooth
Chapter 9
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
The first thing to do is identify the data format. The class that allows you to do this is
javax.print.DocFlavor. For instance, if you wanted to tell the print service that you want to print out
Chapter 12 - Bluetooth and Jini
GIF files, then the code would look something like this:
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Appendix A - javax.bluetooth
Appendix B - javax.obex
DocFlavor docflavor = DocFlavor.INPUT_STREAM.GIF;
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
The JPS also has the functionality built in to print other popular binary formats like PDF, PostScript, PNG,
List
Figures
andofJPEG.
List of Tables
List of Listings
Creating a Document
List of Sidebars
Now that you've specified a document format, the next step is to create a document. All documents in JPS
must implement the javax.print.Doc interface. You can implement this interface yourself, or you can
use the javax.print.SimpleDocobject to encapsulate your data into a document. Following is a
snippet of code that demonstrates how to create a document from a GIF file:
DocFlavor flavor = DocFlavor.INPUT_STREAM.GIF;
FileInputStream fInput = new FileInputStream("nicePic.gif");
Doc doc = new SimpleDoc(fInput, flavor, null);
Searching for a Print Service
Now it's time to find a suitable printer for your needs. In the JPS, you'll never interact directly with a printer;
you will always have to interact with a print service that represents that printer. So, when you are searching
for a printer (either connected peripherally to your computer, or somewhere on your network), you are
searching for print services.
The code that follows shows you how to search for a print service that can print GIF files. In addition, this
example also demonstrates how to specify some print attributes; this print service is capable of printing two
copies, double-sided, on A4 size paper.
DocFlavor flavor
= DocFlavor.INPUT_STREAM.GIF;
Bluetooth
for Java
PrintRequestAttributeSet
attribSet = new HashPrintRequestAttributeSet();
ISBN:1590590783
by Bruce Hopkins and Ranjith Antony
attribSet.add(new
Copies(2));
Apress © 2003 (352 pages)
attribSet.add(MediaSizeName.ISO_A4);
The authors of this text describe how to develop wireless Java
attribSet.add(Sides.TWO_SIDED_LONG_EDGE);
applications using Bluetooth for a variety of platforms. This
PrintService[]
services
=
includes
an API overview
of the Java library, development of
Bluetooth-based services, highlights of security concerns,
and
PrintServiceLookup.lookupPrintServices(flavor,
attribSet);
more.
As you can see, the static method lookupPrintServices() from the class
javax.print.PrintServiceLookup returns an array of PrintService objects.
Bluetooth
for Java
EachPrintService
represents a printer that is capable of printing according to the attributes that you
Introduction
specified.
Table of Contents
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Creating
a Print Job and Printing
- Before You Get Started
Chapter 3
Chapter
4 - done,
Understanding
the Java
API
After that's
the next step
is toBluetooth
create the
print job and submit the job to a print service. Once you
Chapter
5
Bluetooth
with
J2ME
MIDP
have an instance of a PrintService object, just call the createPrintJob() method, and it will return
Chapter
6 - Creating
a Bluetooth
Server
JPS API
aDocPrintJob
object
(which isPrint
a print
job).with
In order
to print, just call the print() method on the
Chapter
7
Java
and
OBEX
DocPrintJobobject and provide it with the document that you want to print as well as the print
Chapter
8 -The
Using
a Bluetooth
Simulator
attributes.
code
snippet that
follows shows how to create a print job and submit it:
Chapter 9 - Bluetooth Security
Chapter
10 - Wireless
Embedded
with the Micro BlueTarget
DocPrintJob
printJob
= Systems
services[0].createPrintJob();
Chapter
try{ 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter
12 - Bluetooth and Jini
printJob.print(doc,
attribSet);
Appendix
} catch
A -(PrintException
javax.bluetooth
e){
}
Appendix
B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Listening for Status Updates
Index
List of Figures
Optionally,
List
of Tablesyou can listen to status updates on your print job after you have submitted it. For instance, if
youofhaven't
List
Listingsreceived an update from the printer in a while, you may also want to get a status update on the
printer
itself (it may be out of paper or something). The classes that enable you to do this are
List
of Sidebars
javax.print.event.PrintServiceAttributeListener,
javax.print.event.PrintJobAttributeListener, and
javax.print.event.PrintJobListener. By implementing these interfaces, you'll receive callbacks
from the JVM upon changes in state of the printer or the print job.
for Java
A CompleteBluetooth
JPS Application:
JPSPrint
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
Listing 6-1 showsApress
the complete
source
© 2003 (352
pages) for JPSPrint.java, summarizing all the material that we've
covered so far. It The
includes
an
inner
named how
PrintStatus,
which implements
the
authors of this class
text describe
to develop wireless
Java
PrintJobListener
interface.
This
code
will
provide
the
status
of
a
print
job
by
displaying
a few text
applications using Bluetooth for a variety of platforms. This
an line
API overview of the Java library, development of
messages at the includes
command
Bluetooth-based services, highlights of security concerns, and
more.
Listing 6-1: JPSPrint.java
Table
of Contents
import
java.io.*;
Bluetooth
import for
javax.print.*;
Java
import javax.print.event.*;
Introduction
import
Chapter
1 javax.print.attribute.*;
- Introducing Bluetooth
import
Chapter
2 javax.print.attribute.standard.*;
- Bluetooth 1.1
Chapter 3
- Before You Get Started
class4 PrintStatus
PrintJobListener
{
Chapter
- Understandingimplements
the Java Bluetooth
API
Chapter 5
- Bluetooth with J2ME MIDP
public void printDataTransferCompleted(PrintJobEvent pje) {
- Creating a Bluetooth Print Server with JPS API
System.out.println("Data delivered to printer successfully...");
Chapter 7 - Java and OBEX
}
Chapter 8 - Using a Bluetooth Simulator
public void printJobCanceled(PrintJobEvent pje) {
Chapter 9 - Bluetooth Security
System.out.println("The print job has been cancelled...");
Chapter}10 - Wireless Embedded Systems with the Micro BlueTarget
Chapterpublic
11 - Enterprise
Bluetooth Applications with the Ericsson BlipNet
void printJobCompleted(PrintJobEvent
pje) {
Chapter 12 System.out.println("The
- Bluetooth and Jini
print job completed successfully...");
Appendix
} A - javax.bluetooth
Appendix
B - javax.obex
public
void printJobFailed(PrintJobEvent pje) {
Appendix C System.out.println("The
- Java Bluetooth Development on the
document
PalmOS Platform
failed to print ..");
} D - BlipNet 1.1 API
Appendix
Index public void printJobNoMoreEvents(PrintJobEvent pje) {
System.out.println("No more events to deliver...");
List of Figures
}
List of Tables
public void printJobRequiresAttention(PrintJobEvent pje) {
List of Listings
System.out.println("Something terrible" +
List of Sidebars
"happened which requires attention...");
}
}
Chapter 6
public class JPSPrint {
public static void main(String args[]) throws FileNotFoundException{
PrintStatus status = new PrintStatus();
// Create the DocFlavor for GIF
DocFlavor flavor = DocFlavor.INPUT_STREAM.GIF;
// Create an attribute set comprising of the print instructions
PrintRequestAttributeSet attribSet = new HashPrintRequestAttributeSet();
attribSet.add(new Copies(1));
attribSet.add(MediaSizeName.ISO_A4);
// Locate print services, which can print a GIF in the manner specified
PrintService[] pservices =
PrintServiceLookup.lookupPrintServices(flavor, attribSet);
if (pservices.length > 0) {
Bluetooth for Java
ISBN:1590590783
by Bruce Hopkins
Ranjith Antony
DocPrintJob
job = and
pservices[0].createPrintJob();
Apress © 2003 (352 pages)
The authors
of this text describe
how to develop wireless Java
// Adding
a PrintStatus
Listener
applications
using
Bluetooth
for
a
variety of platforms. This
job.addPrintJobListener(status);
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
// Create
more. a Doc implementation to pass the print data
FileInputStream fInput = new FileInputStream("nicePic.gif");
Doc doc = new SimpleDoc(fInput, flavor, null);
Table of Contents
Bluetooth for
//Java
Print the doc as specified
Introductiontry {
Chapter 1
- Introducing
Bluetooth attribSet);
job.print(doc,
Chapter 2 }- Bluetooth 1.1
e) {
Chapter 3 catch
- Before (PrintException
You Get Started
System.err.println(e);
- Understanding
the Java Bluetooth API
Chapter 5 }- Bluetooth with J2ME MIDP
Chapter 4
Chapter}6
- Creating a Bluetooth Print Server with JPS API
Chapterelse
7 - Java and OBEX
System.err.println("No
suitable printers");
- Using a Bluetooth Simulator
Chapter 8
}
Chapter 9
}
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix
A - javax.bluetooth
Caution
The JPS API is a part of JDK 1.4, and older versions of the JDK are not capable of running
Appendix B - javax.obex
the JPSPrint example.
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
for Bluetooth
Java
IntegratingBluetooth
JPS and
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
Now that you have
a full©working
of a JPS application under your belt, let's see what it will take in order
Apress
2003 (352example
pages)
to turn this ordinary
JPS
print
service
into
a
Bluetooth-enabled,
print server (refer back to Figure 6-2).
The authors of this text describe
how to develop wireless
wireless Java
applications using Bluetooth for a variety of platforms. This
The algorithm forincludes
the application
is pretty of
simple.
Thelibrary,
computer
that functions
as the print server will start an
an API overview
the Java
development
of
Bluetooth-based
highlights
of incoming
security concerns,
and
L2CAP server and
wait for clientsservices,
to connect.
After an
file is received
by the server, it is printed to a
more.
printer using the JPS
API.
Note As you may have already guessed, this application won't work if you use a JSR-82-compliant Java
Bluetooth development kit. Why? Well, as we stated in Chapter 3, the official Java Bluetooth API has
Bluetooth for
Java
a dependency
on the Generic Connection Framework (GCF) to exist, which unfortunately is not a part
Introductionof the J2SE JDK 1.4.
Table of Contents
Chapter 1
- Introducing Bluetooth
Chapter 2
That
doesn't1.1
mean that Java Bluetooth development kits don't exist for the J2SE. In fact, Atinav,
- Bluetooth
Rococo,
and
Zucotto
all make Java Bluetooth development kits for the J2SE. At the time of this
- Before You Get
Started
writing,
Atinav's
and
Rococo's
J2SE
implementation closely matches that of the JSR-82
- Understanding the Java Bluetooth
API
implementations.
The
next
example
uses the Atinav J2SE Bluetooth development kit.
- Bluetooth with J2ME MIDP
Chapter 3
Chapter 4
Chapter 5
Chapter
a Bluetooth
Server with
API example, JPSBluetoothPrint.java. As you can
Listing 66-2-isCreating
the server
code forPrint
the wireless
printJPS
server
Chapter
7
Java
and
OBEX
see, it is simply the JPSPrint.java example with a little Bluetooth code thrown in. All the wireless
Chapter
8 - Using
a Bluetooth in
Simulator
functionality
is encapsulated
the method connectToClientAndPrint(). When this method is called, the
Chapter
9 -wait
Bluetooth
server will
until a Security
client attempts to connect at an L2CAP channel. After the client connects and sends a
Chapter
- Wireless
Embedded
Systems
the Micro BlueTarget
file, the10
server
will attempt
to print
it withwith
its printFile()
method.
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Listing12
6-2:
JPSBluetoothPrint.java
Chapter
- Bluetooth
and Jini
Appendix A - javax.bluetooth
Appendix
- javax.obex
importB java.io.*;
Appendix
importC javax.print.*;
- Java Bluetooth Development on the PalmOS Platform
importD javax.print.event.*;
Appendix
- BlipNet 1.1 API
import javax.print.attribute.*;
Index
import
javax.print.attribute.standard.*;
List
of Figures
import
javax.bluetooth.*;
List
of Tables
import
com.atinav.standardedition.io.*;
List
of Listings
List of Sidebars
class PrintStatus implements PrintJobListener {
public void printDataTransferCompleted(PrintJobEvent pje) {
System.out.println("Data delivered to printer successfully...");
}
public void printJobCanceled(PrintJobEvent pje) {
System.out.println("The print job has been cancelled...");
}
public void printJobCompleted(PrintJobEvent pje) {
System.out.println("The print job completed successfully...");
}
public void printJobFailed(PrintJobEvent pje) {
System.out.println("The document failed to print ..");
}
public void printJobNoMoreEvents(PrintJobEvent pje) {
System.out.println("No more events to deliver...");
}
public void printJobRequiresAttention(PrintJobEvent pje) {
System.out.println("Some thing terrible happened which" +
"requires attention...");
}
}
Bluetooth for Java
ISBN:1590590783
by Bruce Hopkins and Ranjith Antony
Apress
©
2003
(352
pages)
public class JPSBluetoothPrint implements Runnable {
The authors of this text describe how to develop wireless Java
applications
using Bluetooth
for a variety of platforms. This
L2CAPConnection
l2capConn
= null;
includes an API overview of the Java library, development of
private int
maxRecv =services,
-1; highlights of security concerns, and
Bluetooth-based
more.
private boolean printFile(String fileName) throws FileNotFoundException{
Table of Contents
System.out.println("Invoking Common printAPI for printing file : "+
Bluetooth for Java
fileName);
Introduction
Chapter 1 PrintStatus
- Introducing Bluetooth
status = new PrintStatus();
Chapter 2 - Bluetooth 1.1
Create
DocFlavor for GIF
Chapter 3 //- Before
Youthe
Get Started
flavor
= DocFlavor.INPUT_STREAM.GIF;
Chapter 4 DocFlavor
- Understanding
the Java
Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Createa an
attribute
setwith
comprised
of the print instructions
Chapter 6 //- Creating
Bluetooth
Print Server
JPS API
attribSet = new HashPrintRequestAttributeSet();
Chapter 7 PrintRequestAttributeSet
- Java and OBEX
Chapter 8
Chapter 9
attribSet.add(new
Copies(1));
- Using a Bluetooth Simulator
attribSet.add(MediaSizeName.ISO_A4);
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
// Locate print services, which can print a GIF in the manner specified
PrintService[] pservices = PrintServiceLookup.lookupPrintServices(flavor,
Chapter 12 - Bluetooth and Jini
attribSet);
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Appendix A - javax.bluetooth
Appendix B
if- javax.obex
(pservices.length > 0) {
Appendix C - Java
Bluetooth Development
on the PalmOS Platform
DocPrintJob
job = pservices[0].createPrintJob();
Appendix D - BlipNet 1.1 API
Index
// Adding a PrintStatus Listener
List of Figures job.addPrintJobListener(status);
List of Tables
List of Listings // Create a Doc implementation to pass the print data
List of Sidebars FileInputStream fInput = new FileInputStream(fileName);
Doc doc = new SimpleDoc(fInput, flavor, null);
// Print the doc as specified
try {
job.print(doc, attribSet);
}
catch (PrintException e) {
System.err.println(e);
}
}
else
System.err.println("No suitable printers");
return true;
}
public void connectToClientAndPrint() throws Exception {
System.out.println("Host Device = "+
LocalDevice.getLocalDevice().getBluetoothAddress());
String url = "btl2cap://localhost:" + uuid + ";name=simplePrintServer";
UUID uuid = new UUID("6666", true);
L2CAPConnectionNotifier l2capNotifier =
Bluetooth for Java (L2CAPConnectionNotifier) Connector.open(url);
ISBN:1590590783
by Bruce
and Ranjith Antony
l2capConn
= Hopkins
l2capNotifier.acceptAndOpen();
Apress
©
2003
(352
pages)
maxRecv = l2capConn.getReceiveMTU();
The authors of this text describe how
develop
wireless Java
System.out.println("Connected
toto a
client..."
+
applications using Bluetooth
for
a
variety
of
platforms.
This "+ maxRecv);
"Receive buffer Size is:
includes an API overview of the Java library, development of
new Thread(this).start();
Bluetooth-based services, highlights of security concerns, and
}
more.
public void run() {
Table of Contents
try {
Bluetooth for Java
// packet receive
Introduction
byte [] data =
new byte[maxRecv];
Chapter 1
- Introducing
Bluetooth
// Reading
fileName
Chapter 2
- Bluetooth
// blocks
1.1
assuming fileName always less than 48 bytes
Chapter 3
int You
dataSize
= l2capConn.receive(data);
- Before
Get Started
Chapter 4
byte [] fileNameAsBytes
- Understanding
the Java Bluetooth API= new byte[dataSize];
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
System.arraycopy(data,0,fileNameAsBytes,
0,dataSize);
- Creating
a Bluetooth Print Server with JPS API
Chapter 7
String
fileName = new String(fileNameAsBytes);
- Java
and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
System.out.println("File Name is = "+ fileName);
FileOutputStream toFileStrm = new FileOutputStream(new File(fileName));
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
try {
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
System.out.println("Starting to Receive file Body");
Appendix B - javax.obex
Appendix C - Java Bluetooth
Development
the PalmOS Platform
// receive
File on
body
Appendix D - BlipNetwhile(true)
1.1 API
{
Index
if (l2capConn.ready()) {
List of Figures
dataSize = l2capConn.receive(data);
List of Tables
List of Listings
List of Sidebars
// after the whole file, an empty packet is sent from
// the other end
if (dataSize == 0) {
System.out.println("Signal to Stop recieved");
toFileStrm.close();
toFileStrm = null;
printFile(fileName);
break;
}
toFileStrm.write(data, 0, dataSize);
}
try {
Thread.currentThread().sleep(10);
}catch(Exception genExp) {}
}
}
finally {
try {l2capConn.close();}catch(Exception genExp) {}
}
}
catch(Exception genEx) {
}
}
public static void main(String [] args) throws Exception {
Bluetooth for Java
ISBN:1590590783
by Bruce Hopkins and
Antony
JPSBluetoothPrint
srvRanjith
=
new
JPSBluetoothPrint();
Apress
©
2003
(352
pages)
srv.connectToClientAndPrint();
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
}
}
Listing 6-3 has the code that a client would use in order to submit a file to the print server. This code would run
Table
of Contents
on any
Bluetooth-enabled J2ME device.
Bluetooth for Java
Listing 6-3: JPSBluetoothPrintClient.java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter
2 java.io.*;
- Bluetooth 1.1
import
Chapter
3 java.util.*;
- Before You Get Started
import
Chapter
import
4 javax.bluetooth.*;
- Understanding the Java Bluetooth API
import
Chapter
5 javax.obex.*;
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
public
JPSBluetoothPrintClient
implements DiscoveryListener {
Chapter
7 class
- Java and
OBEX
local Simulator
= null;
ChapterLocalDevice
8 - Using a Bluetooth
agent = null;
ChapterDiscoveryAgent
9 - Bluetooth Security
int[] attrSet = null;
RemoteDevice btDev = null;
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
String serviceURL = null;
Chapter 12 - Bluetooth and Jini
L2CAPConnection l2capConn = null;
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Appendix A - javax.bluetooth
Appendix B - javax.obex
public JPSBluetoothPrintClient() throws BluetoothStateException {
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D local
- BlipNet=1.1
API
LocalDevice.getLocalDevice();
Index
agent = local.getDiscoveryAgent();
List of Figures
agent.startInquiry(DiscoveryAgent.GIAC, this);
List of Tables
synchronized(this){ //Waiting for Device Inquiry to be completed
List of Listings try{
List of Sidebars
this.wait();
}catch(Exception IntE){
System.out.println(IntE.getMessage());
}
}
}
public void deviceDiscovered(RemoteDevice btDevice,DeviceClass cod){
if ("011114378000".indexOf(btDevice.getBluetoothAddress())> -1){
btDev = btDevice;System.out.println("Assigned");
}
System.out.println("Device discovered "+btDevice.getBluetoothAddress());
}
public void servicesDiscovered(int transID, ServiceRecord[] servRecord){
System.out.println("Discovered a service.... ");
for(int i =0; i < servRecord.length; i++){
serviceURL = servRecord[i].getConnectionURL
(ServiceRecord.NOAUTHENTICATE_NOENCRYPT,true);
System.out.println("The service URL is "+serviceURL);
}
}
Bluetooth for Java
ISBN:1590590783
by Bruce
Hopkins and Ranjith Antony
public void
serviceSearchCompleted(int
transID,
int respCode){
Apress
©
2003
(352
pages)
System.out.println("Service search completed.......... . ");
The authors of this text
describe how to the
develop
wireless
synchronized(this){
//Unblocking
wait
forJava
Service search complete
applications
using
Bluetooth
for
a
variety
of
platforms.
This
try{
includes an API overview of the Java library, development of
this.notifyAll();
Bluetooth-based
services, highlights of security concerns, and
}catch(Exception
IntE){
more.
System.out.println(IntE.getMessage());
}
Table of Contents
}
Bluetooth for Java
Introduction
}
Chapter 1
- Introducing Bluetooth
Chapterpublic
2 - Bluetooth
void 1.1
inquiryCompleted(int discType){
Chapter 3
completed...");
-System.out.println("Inquiry
Before You Get Started
Chapter 4
//Unblocking
the wait for inquiry complete
-synchronized(this){
Understanding the Java Bluetooth
API
Chapter 5
try{with J2ME MIDP
- Bluetooth
Chapter 6
- Creating athis.notifyAll();
Bluetooth Print Server with JPS API
Chapter 7
IntE){
- Java }catch(Exception
and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
System.out.println(IntE.getMessage());
}
}
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
}
Appendix A - javax.bluetooth
Appendix
B - javax.obex
public
void getServices(){
Appendix C -UUID[]
Java Bluetooth
Development
on the PalmOS Platform
uuids
= new UUID[1];
Appendix D -uuids[0]
BlipNet 1.1 API
= new UUID("6666", true);
Index
try{
if(btDev == null){
System.out.println("No device has been discovered, "+
List of Tables
"hence not worth proceeding,exiting.... ");
List of Listings
System.exit(1);
List of Sidebars
}
System.out.println("Now searching for services....... . ");
agent.searchServices(attrSet, uuids, btDev, this);
List of Figures
}
catch(BluetoothStateException e) {
System.out.println(e.getMessage());
System.out.println("Got an exception, so exiting...");
System.exit(1);
}
synchronized(this){ //Waiting for Service Search to be completed
try{
this.wait();
}catch(Exception IntE){
System.out.println(IntE.getMessage());
}
}
}
public boolean sendFile(String fileName){
try {Bluetooth for Java
ISBN:1590590783
by Bruce Hopkins
and Ranjith Antony
l2capConn
= (L2CAPConnection)Connector.open(serviceURL);
Apress © 2003 (352 pages)
The authors of this textinConn
describe how
InputConnection
= to develop wireless Java
applications
using
Bluetooth
for
a
variety of platforms. This
(InputConnection)Connector.open("file://name="+fileName+";mode=r");
includes an API overview of the Java library, development of
InputStream
fileReader
= inConn.openInputStream();
Bluetooth-based services,
highlights
of security concerns, and
more.
int maxSendMTU = l2capConn.getTransmitMTU();
byte [] buffer = new byte[maxSendMTU];
Table of Contents
Bluetooth for Java // sending fileName
Introduction
// assuming for the time being that the fileName
Chapter 1 - Introducing
Bluetooth
// will
not be greater than 48 bytes
Chapter 2
- Bluetooth
l2capConn.send(fileName.getBytes());
1.1
Chapter 3
System.out.println("Send
the file Name = "+ fileName);
- Before
You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
// sending
fileContent
- Bluetooth
with J2ME MIDP
Chapter 6
// aafter
the
whole
gets
- Creating
Bluetooth
Print
Serverfile
with JPS
API transferred, an empty packet is sent.
Chapter 7
actualDataSize = -1;
- Java int
and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
-
Chapter 10 Chapter 11 Chapter 12 Appendix A -
byte [] pkt = null;
while((actualDataSize = fileReader.read(buffer)) != -1) {
Bluetooth Security
pkt = new byte[actualDataSize];
Wireless Embedded Systems with the Micro BlueTarget
System.arraycopy(buffer, 0, pkt, 0, actualDataSize);
Enterprise Bluetooth Applications with the Ericsson BlipNet
l2capConn.send(pkt);
Bluetooth and Jini
}
javax.bluetooth
System.out.println("Completed sendng body of file = "+ fileName);
Appendix B - javax.obex
Appendix C - Java //sending
Bluetooth Development
on the PalmOS
Platformend of file
empty packet
signaling
Appendix D - BlipNet
1.1
API
l2capConn.send(new byte[0]);
Index
List of Figures
List of Tables
fileReader.close();
return true;
}
List of Listings
List of Sidebars
catch(IOException e){
System.out.println(e.getMessage());
return false;
}
finally {
System.out.println("Closing connection");
try {l2capConn.close();}catch(Exception genx) {}
}
}
public static void main(String args[]) throws Exception {
JPSBluetoothPrintClient client = new JPSBluetoothPrintClient();
client.getServices();
System.out.println(client.sendFile(args[0]));
}
}
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Summary
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
This chapter wasApress
probably
your
first
time working with the new Java Print Service APIs. The JPS is a
© 2003
(352
pages)
platform-independent
printing
solution
newhow
in JDK
1.4. In this
chapter,
The authors of this textthat's
describe
to develop
wireless
Java you learned about all the
steps that are necessary
to
create
a
complete
JPS
application,
such
as
identifying the data format,
applications using Bluetooth for a variety of platforms. This
includes
an specifying
API overview
of the Java
development
of
searching for print
services,
attributes,
andlibrary,
creating
and submitting
print jobs. After creating a
Bluetooth-based
services,
highlights
security print
concerns,
and
simple JPS application,
you learned
how to
turn yourofordinary
service
into a Bluetooth-enabled print
more.
server!
This chapter demonstrated communication with Bluetooth using the L2CAP protocol. This is ideal if you
want to transfer items between two devices that can be broken into packets and reassembled again (such
Bluetooth for Java
as files). L2CAP is a layer below RFCOMM in the Bluetooth protocol stack, so if you optimize your MTU,
Introduction
you can achieve significantly faster data transfers between wireless devices. In Chapter 7, we'll examine a
Chapter 1 - Introducing Bluetooth
more robust Bluetooth protocol for transferring files: OBEX.
Table of Contents
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
for Java
Chapter Bluetooth
7: Java
and OBEX
by Bruce Hopkins and Ranjith Antony
Overview
ISBN:1590590783
Apress © 2003 (352 pages)
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
Whether you likeincludes
it or not,an
you're
API overview
surrounded
of the
by Java
objects
library,
every
development
day. In fact,ofpart of the role of being a good
services,
concerns,
and objects when developing
Java programmerBluetooth-based
is to find out what
is thehighlights
best way of
to security
recognize
and create
more.
business applications (and games, too). As we stated in Chapter 4, the Bluetooth specification gives you
three protocols to send and receive data:
Table of Contents
RFCOMM (for stream data)
Bluetooth for Java
Introduction
L2CAP (for packet data)
Chapter 1 - Introducing Bluetooth
OBEX
object 1.1
data)
Chapter
2 - (for
Bluetooth
Chapter 3
- Before You Get Started
In this chapter, we'll discuss the mechanics of the OBEX protocol, and how to send objects between
Chapter
4 devices.
- Understanding
the Java
Bluetooth
Bluetooth
We'll cover
the APIs
in theAPI
javax.obex package, and finish things up by
Chapter
5
Bluetooth
with
J2ME
MIDP
demonstrating how to send files between two devices using OBEX.
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
What Is OBEX?
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
OBEX (which stands
for©OBject
EXchange)
is a communication protocol that allows object data to be
Apress
2003 (352
pages)
transferred between
two
devices
(it
doesn't
matter
if those
devices
are wirelessly
or physically connected).
The authors of this text describe how
to develop
wireless
Java
OBEX was originally
created
by
the
Infrared
Data
Association
(IrDA),
but
it
later
became
one of the
applications using Bluetooth for a variety of platforms. This
includes
an API
of theaJava
development
Bluetooth adopted
protocols
(likeoverview
WAP). Take
looklibrary,
at Figure
7-1 to seeofwhere OBEX fits in the Bluetooth
services, highlights of security concerns, and
and IrDA protocolBluetooth-based
stacks.
more.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Figure
is called
IrOBEX in the IrDA protocol stack.
Chapter
8 - 7-1:
UsingOBEX
a Bluetooth
Simulator
Chapter 9
- Bluetooth Security
Chapter
10 - Wireless
EmbeddedOBEX
Systems
withunderlying
the Micro BlueTarget
In the Bluetooth
specification,
is the
protocol that is used to implement the following
Chapter
11
Enterprise
Bluetooth
Applications
with
the Ericsson BlipNet
Bluetooth profiles:
Chapter 12 - Bluetooth and Jini
Generic
Object Exchange Profile
Appendix
A - javax.bluetooth
Appendix B - javax.obex
Object Push Profile
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix
D - BlipNet 1.1
API
Synchronization
Profile
Index
Transfer Profile
List ofFile
Figures
List of Tables
Basic Imaging Profile
List of Listings
List ofBasic
Sidebars
Printing Profile
Note Did you realize that the official Java OBEX implementation was named javax.obex and not
javax.bluetooth.obex? It was named javax.obex because the JSR-82 designers knew
that (if structured correctly) the OBEX libraries would be the same regardless of the underlying
transmission protocol (also known as the bearer or the transport). So, you can use the classes in
thejavax.obex package to send objects between any device that implements the official Java
OBEX API. The JSR-82 provides guidelines on how to use OBEX over Bluetooth, IR, and TCP/IP
connections.
The OBEX protocol has a simple client/server architecture. OBEX clients get objects from and put objects
onto OBEX servers. OBEX servers wait around for incoming requests from clients. The OBEX definition
can be summarized in two parts: the OBEX Object Model and the OBEX Session Protocol. The Object
Model provides the definition of OBEX objects and information on how to transfer them. The Session
Protocol defines the handshaking that needs to occur between the client and the server when transferring
objects between devices. Let's look at OBEX Object Model and Session Protocol in more detail.
The OBEX Object Model
In the OBEX Object Model, all the details about an object are represented as attributes called headers.
Each header will contain information about the object (i.e., the name of the object) or the object itself. The
Object Model defines headers as one byte for the header ID, and one or more bytes for the header's
value. A typical OBEX header is illustrated in Figure 7-2.
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based
Figure 7-2: An
OBEX headerservices, highlights of security concerns, and
more.
The OBEX Object Model has defined 17 headers for OBEX object attributes. However, the official Java
OBEX specification uses only 12 of them as constants in the interface java.obex.HeaderSet. These
Table of Contents
constants are listed in Table 7-1.
Bluetooth for Java
Introduction
Table 7-1: OBEX Headers in the java.obex.HeaderSet Interface
Chapter 1
- Introducing Bluetooth
HEADER
NAME 1.1
Chapter
2 - ID
Bluetooth
HEADER
Chapter 3 - Before You Get Started ID
DECIMALAPI
Chapter 4 - Understanding the Java Bluetooth
VALUE
Chapter 5 - Bluetooth with J2ME MIDP
JAVA TYPE
Chapter 6
Server with JPS
API
java.lang.Long
COUNT - Creating a Bluetooth Print192
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
NAME9
Chapter
- Bluetooth Security
1
java.lang.String
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter
TYPE12 - Bluetooth and Jini
66
java.lang.String
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
LENGTH
DESCRIPTION
The number of
objects to be sent
The object's name
(usually used as the
filename)
The type of the
object, like
text/plain
195
java.lang.Long
The length of the
object in bytes
68
java.util.Calendar
The time in ISO
8601 format
196
java.util.Calendar
The time
represented as a 4byte integer
DESCRIPTION
5
java.lang.String
A description of the
object
TARGET
70
byte[]
The name of the
service that the
object is being sent
to
HTTP
71
byte[]
The HTTP version
1.x header
WHO
74
byte[]
Refers to the peer
OBEX application if
peers are involved
OBJECT_CLASS
79
byte[]
The OBEX object
class for the object
Appendix D - BlipNet 1.1 API
Index
ListTIME_ISO_8601
of Figures
List of Tables
ListTIME_4_BYTE
of Listings
List of Sidebars
APPLICATION_PARAMETER
76
Bluetooth for Java
byte[]
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
Data that
represents request
and response
parameters for the
OBEX application
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
You are also freemore.
to create your own headers as long as you obey the following guidelines:
java.lang.String object types should have a header ID decimal value between 48 and 63.
Table of Contents
bytefor
arrays
Bluetooth
Java(i.e. byte[]) should have a header ID decimal value between 112 and 127.
Introduction
java.lang.Byte object types should have a header ID decimal value between 176 and 191.
Chapter 1
- Introducing Bluetooth
Chapter
2 - Bluetooth 1.1object types should have a header ID decimal value between 240 and 255.
java.lang.Long
Chapter 3 - Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
The OBEX
Session Protocol
- Bluetooth with J2ME MIDP
Chapter 5
Chapter
6 - Session
Creating Protocol
a Bluetooth
Print Server
withand
JPSprocesses
API
The OBEX
specifies
all rules
for communication between OBEX clients
Chapter
7
Java
and
OBEX
and servers. The communication scheme is a simple request-response process: The client sends a
Chapter
8 and
- Using
a Bluetooth
Simulator
request,
the server
responds.
Both requests and responses are sent as packets. Clients communicate
Chapter
9 - Bluetooth
to the server
via eight Security
simple operations:
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
CONNECT
Chapter
11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
DISCONNECT
Appendix A - javax.bluetooth
Appendix
PUTB - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
GET
Appendix D - BlipNet 1.1 API
Index SETPATH
List of Figures
List ofABORT
Tables
List of Listings
CREATE-EMPTY
List of Sidebars
PUT-DELETE
OBEX servers, in turn, return responses back to the OBEX clients, such as the following:
SUCCESS
FAILURE
CONTINUE
Note There are a lot more OBEX responses than just these three. All the valid response codes in the
javax.obex API are contained in the javax.obex.ResponseCodes class, which is
described later in this chapter.
Figure 7-3 is an illustration of the message flow that takes place during a simple OBEX session.
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Figure 7-3: A sample message flow between OBEX clients and servers
Chapter 5
- Bluetooth with J2ME MIDP
The client
the
communication
process
sending
Chapter
6 -initiates
Creating
a Bluetooth
Print Server
withbyJPS
API a request packet with the CONNECT operation.
The request
packet
the code for the operation, the length of the packet itself, and the headers.
Chapter
7 - Java
andcontains
OBEX
Upon receiving
thea request,
server responds with a response packet that contains the response code,
Chapter
8 - Using
Bluetooththe
Simulator
the response
length, and
some response data. Under normal circumstances, the server returns a packet
Chapter
9 - Bluetooth
Security
with a response code of SUCCESS. If, however, some problem has occurred, then the server returns a
FAILURE code.
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter
12operation
- Bluetooth
and Jini
ThePUT
allows
the client to send an object to the server. It's possible that a small object may fit
Appendix
A - javax.bluetooth
into a single
PUT request packet. If not, then the client sends multiple packets, and the server responds
Appendix
B - javax.obex
with a CONTINUE
response code. The server responds to the final PUT packet with a SUCCESS code.
Appendix C - Java Bluetooth Development on the PalmOS Platform
Similarly,
are1.1
able
Appendix
D clients
- BlipNet
APIto retrieve objects from the server by sending a GET request packet. If the server
accepts the packet, it responds with either a SUCCESS or a CONTINUE response code. If the server
Index
responds with a CONTINUE, then the client continues to send a GET request until the server responds with
aSUCCESS code.
List of Figures
List of Tables
List
of client
Listings
The
uses the SETPATH operation in conjunction with a PUT or GET operation in order to change the
List
of
Sidebars
directory on the server. The client can also use the ABORT operation in order to end the session with the
server prematurely. The client can create an empty file on the server using the CREATE-EMPTY operation,
and it can remove an object from the server using the PUT-DELETE operation.
Now that you have a pretty good understanding of the overall functionality of OBEX, let's take a look at the
Java OBEX APIs.
Bluetooth
Java
The OBEX APIs
in for
the
JSR-82
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
The following eight
classes
and
interfaces
make up the javax.obex package in the JSR-82 API. Some
Apress
© 2003
(352
pages)
of these classes should
look
somewhat
familiar
you—namely
HeaderSet,
The authors of this text describe to
how
to develop wireless
Java ResponseCodes, and
Operation.
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Authenticator
Bluetooth-based services, highlights of security concerns, and
more.
ClientSession
Table of
Contents
HeaderSet
Bluetooth for Java
Operation
Introduction
Chapter 1
- Introducing Bluetooth
PasswordAuthenticator
Chapter 2
- Bluetooth 1.1
Chapter
ResponseCodes
3 - Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
SessionNotifier
- Bluetooth with J2ME MIDP
Chapter 5
Chapter
6 - Creating a Bluetooth Print Server with JPS API
ServerRequestHandler
Chapter 7
- Java and OBEX
Chapter
Now let's
8 take
- Using
a look
a Bluetooth
at someSimulator
of these classes in more detail.
Chapter 9
- Bluetooth Security
javax.obex.ClientSession
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
TheClientSession
interface
is a subclass of the javax.microedition.io.Connection class, and
Chapter
12 - Bluetooth and
Jini
represents
OBEX connection from the client's point of view. You can obtain an instance of this interface
Appendix
A - an
javax.bluetooth
by usingBthe
following line of code:
Appendix
- javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix
ClientSession
D - BlipNet 1.1
session
API
= (ClientSession)Connector.open(connectURL);
Index
List of Figures
This interface provides a way to define headers for OBEX operations. For instance, the methods put()
andget() respectively allow you to create PUT and GET operations. Those methods return a
List of Listings
javax.obex.Operation object so that you can complete the operation.
List of Tables
List of Sidebars
Note See the description of javax.obex.Operation later in this section for more information on
how to complete GET and PUT operations.
The methods connect(),disconnect(), and setPath() complete their respective operations
(CONNECT,DISCONNECT, and SETPATH) and return the result in a javax.obex.HeaderSet object.
javax.obex.HeaderSet
TheHeaderSet interface can be used to define all OBEX headers (even custom headers). It can be
instantiated by calling ClientSession.createHeaderSet(). An example of an OBEX client setting
theNAME and TYPE headers is shown here:
HeaderSet hdr = clientSession.createHeaderSet();
//Creating a header set to request Hello.txt file from the server
hdr.setHeader(HeaderSet.TYPE," text/vCard");
hdr.setHeader(HeaderSet.NAME," Hello.txt");
An OBEX server, in turn, can retrieve the headers sent from the client by calling either getHeader() or
getHeaderList().
Bluetooth for Java
javax.obex.Operation
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
Apress © 2003 (352 pages)
TheOperation interface provides you with all the methods necessary to complete an OBEX GET or PUT
The authors of this text describe how to develop wireless Java
operation. What do
we mean by complete? As you can see in the following code snippet, an Operation
applications using Bluetooth for a variety of platforms. This
was created using
the
put()
method
in ClientSession:
includes
an API
overview
of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
ClientSession session = (ClientSession)Connector.open(connectURL);
Operation op = session.put(null);
Table of Contents
Bluetooth for Java
However, the Operation is not complete until you include the object that you want to send (in the case of
aPUT) and add some headers. Following is an example of how to complete a PUT operation:
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
ClientSession session = (ClientSession)Connector.open(connectURL);
- Before You Get Started
Operation op = session.put(null);
Chapter 4 - Understanding the Java Bluetooth API
OutputStream out = op.openOutputStream();
Chapter 5 - Bluetooth with J2ME MIDP
out.write("Test".getBytes());
Chapter 6 - Creating a Bluetooth Print Server with JPS API
out.close();
Chapter 3
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Now in 9order
to makeSecurity
a CREATE-EMPTY operation, just open and close the OutputStream without
Chapter
- Bluetooth
writing 10
any- data,
as shown
here:
Chapter
Wireless
Embedded
Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter
12 - Bluetooth
and Jini = (ClientSession)Connector.open(connectURL);
ClientSession
session
Appendix
Operation
A - javax.bluetooth
op = session.put(null);
OutputStream
out = op.openOutputStream();
Appendix
B - javax.obex
out.close();
Appendix
C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
The easiest way to create a PUT-DELETE is to call the delete() method of this class.
List of Figures
List of Tables
javax.obex.ResponseCodes
List of Listings
List of Sidebars
TheResponseCodes class contains all the valid response codes that an OBEX server can send to its
client. Since the OBEX request/response model is very similar to that of HTTP, you will see that the
responses are modeled after their HTTP counterparts:
OBEX_DATABASE_FULL
OBEX_DATABASE_LOCKED
OBEX_HTTP_ACCEPTED
OBEX_HTTP_BAD_GATEWAY
OBEX_HTTP_BAD_METHOD
OBEX_HTTP_BAD_REQUEST
OBEX_HTTP_CONFLICT
OBEX_HTTP_CREATED
OBEX_HTTP_ENTITY_TOO_LARGE
OBEX_HTTP_FORBIDDEN
OBEX_HTTP_GATEWAY_TIMEOUT
Bluetooth for Java
OBEX_HTTP_GONE
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
Apress © 2003 (352 pages)
OBEX_HTTP_INTERNAL_ERROR
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
OBEX_HTTP_LENGTH_REQUIRED
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
OBEX_HTTP_MOVED_PERM
more.
OBEX_HTTP_MOVED_TEMP
Table of Contents
OBEX_HTTP_MULT_CHOICE
Bluetooth
for Java
Introduction
OBEX_HTTP_NO_CONTENT
Chapter 1
- Introducing Bluetooth
Chapter
OBEX_HTTP_NOT_ACCEPTABLE
2 - Bluetooth 1.1
Chapter 3
- Before You Get Started
OBEX_HTTP_NOT_AUTHORITATIVE
- Understanding the Java Bluetooth API
Chapter 4
Chapter
5 - Bluetooth with J2ME MIDP
OBEX_HTTP_NOT_FOUND
Chapter 6
- Creating a Bluetooth Print Server with JPS API
OBEX_HTTP_NOT_IMPLEMENTED
Chapter
7 - Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
OBEX_HTTP_NOT_MODIFIED
Chapter
10 - Wireless Embedded Systems with the Micro BlueTarget
OBEX_HTTP_OK
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
OBEX_HTTP_PARTIAL
Chapter
12 - Bluetooth and Jini
Appendix A - javax.bluetooth
OBEX_HTTP_PAYMENT_REQUIRED
Appendix B - javax.obex
Appendix
C - Java Bluetooth Development on the PalmOS Platform
OBEX_HTTP_PRECON_FAILED
Appendix D - BlipNet 1.1 API
Index OBEX_HTTP_PROXY_AUTH
List of Figures
OBEX_HTTP_REQ_TOO_LARGE
List of Tables
List ofOBEX_HTTP_RESET
Listings
List of Sidebars
OBEX_HTTP_SEE_OTHER
OBEX_HTTP_TIMEOUT
OBEX_HTTP_UNAUTHORIZED
OBEX_HTTP_UNAVAILABLE
OBEX_HTTP_UNSUPPORTED_TYPE
OBEX_HTTP_USE_PROXY
OBEX_HTTP_VERSION
Note So where are the response codes that we discussed earlier in this chapter like SUCCESS,
FAILURE, and CONTINUE? Good question. Well, the OBEX SUCCESS response code is
mapped to OBEX_HTTP_OK in the ResponseCodes class. And rather than simply having a
generic response code for FAILURE, there are numerous response codes to indicate what kind
of failure has occurred. Finally, the CONTINUE response will always be handled by your
underlying implementation, so you should never see it.
Here is an example of how to use the ResponseCodes class to determine if your PUT operation was a
success:
for Java
ClientSessionBluetooth
session
= (ClientSession)Connector.open(connectURL);
ISBN:1590590783
by
Bruce
Hopkins
and Ranjith Antony
Operation op = session.put(null);
Apress
©
2003
(352
pages)
OutputStream out = op.openOutputStream();
The authors of this text describe how to develop wireless Java
out.write("Test".getBytes());
out.close(); applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
if(op.getResponseCode()
==
Bluetooth-based services,
highlights of security concerns, and
ResponseCodes.OBEX_HTTP_OK)
more.
System.out.println("PUT operation is success");
Table of Contents
Bluetooth for Java
javax.obex.ServerRequestHandler
Introduction
Chapter 1
- Introducing Bluetooth
TheServerRequestHandler
is a very useful class for OBEX servers. It includes an event listener that
Chapter 2 - Bluetooth 1.1
responds to specific OBEX requests made to the server.
Chapter 3
- Before You Get Started
Chapter
Note
4 This
- Understanding
is a class and
thenot
Java
anBluetooth
interface,API
so in order to use its functionality, you need to extend this
and not
implement
it.
Chapter 5 class
- Bluetooth
with
J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
This class has the following methods that will be called when incoming client requests contain the
- Java and OBEX
corresponding operation:
Chapter 7
Chapter 8
- Using a Bluetooth Simulator
Chapter
9 - Bluetooth Security
onConnect()
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
onSetPath()
Chapter
11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
onDelete()
Appendix A - javax.bluetooth
Appendix
B - javax.obex
onGet()
Appendix C - Java Bluetooth Development on the PalmOS Platform
onPut()
Appendix
D - BlipNet 1.1 API
Index
After the callback method has been called by the JVM, you can obtain the headers from the Operation
object as shown here:
List of Figures
List of Tables
List of Listings
public int onGet(Operation op) {
try{
HeaderSet hdr = op.getReceivedHeaders();
}
List of Sidebars
javax.obex.SessionNotifier
The SessionNotifier interface follows the same pattern as all notifiers in J2ME. A device that wants to be
an OBEX server must implement this interface and call the acceptAndOpen() method and wait for clients,
as shown in the following code:
SessionNotifier sn = (SessionNotifier)
Connector.open("btgoep://localhost:1106;name = FTP");
sn.acceptAndOpen(serverRequestHandler);
Once the server accepts a connection from a client, it then opens a channel for the client. The subclass of
ServerRequestHandler that you passed to the acceptAndOpen() method is notified of all
subsequent requests from the client.
Now that we've covered many of the classes of the Java OBEX API, let's look at an example that puts
these concepts together.
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth
for Java
File Transfer
Example
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
In the file transferApress
example,
we'll
the code that's needed to send a file between two Bluetooth devices
© 2003
(352examine
pages)
using the OBEX API
of
the
JSR-82.
The
server
complex
than
the client code, so we'll present that
The authors of this text describecode
how is
to less
develop
wireless
Java
first.
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
File Transfer Server
Before any clients can connect, the server must register the service in the SDDB. This is accomplished in the
Table
Contents
mainofmethod
as shown here:
Bluetooth for Java
Introduction
public static void main(String args[]) throws IOException {
Chapter 1 FTServer
- Introducing
Bluetooth
server
= new FTServer();
Chapter 2 LocalDevice
- Bluetooth 1.1 localDevice = LocalDevice.getLocalDevice();
Chapter 3 SessionNotifier
- Before You Get Started
sn =
Chapter 4 (SessionNotifier)Connector.open("btgoep://localhost:1106;name=FTP");
- Understanding the Java Bluetooth API
for a client connection.... . ");
Chapter 5 System.out.println("Waiting
- Bluetooth with J2ME MIDP
Chapter 6 sn.acceptAndOpen(server);
- Creating a Bluetooth Print Server with JPS API
Client now connected.... ");
Chapter 7 System.out.println("A
- Java and OBEX
} 8
Chapter
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
A service record has now been created and stored in the SDDB of the server device. Now let's take a closer look
at the connection URL:
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
btgoep://localhost:1106;name=FTP
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix
D - BlipNet
As you can
see, we1.1
areAPI
using a new protocol for communication: btgoep (which stands for Bluetooth Generic
Index
Object Exchange Profile). Because this is a server device, the address will always be localhost. The UUID for
List
thisofservice
Figuresis 1106, which is the UUID for OBEX file transfers.
List of Tables
CROSSREFERENCE
List of Listings
SeeTable 4-4 for UUID values for Bluetooth services and their corresponding profiles.
List of Sidebars
We also gave a friendly name for this service, which is FTP. Our file transfer server has extended the
ServerRequestHandler class, and has overridden the onConnect() and onGet() methods. Here, the
onGet() method will attempt to read the requested file from the local storage and send the file back to the
client. Obviously, the onConnect() and onGet() methods are only called if the clients send a CONNECT or
GET operation to the server. The code for the file transfer server is shown in Listing 7-1.
Listing 7-1: FTServer.java
import
import
import
import
javax.microedition.io.*;
java.io.*;
javax.bluetooth.*;
javax.obex.*;
public class FTServer extends ServerRequestHandler{
public FTServer() throws BluetoothStateException {
// initialize the stack, if needed
}
public int onConnect(HeaderSet request, HeaderSet reply) {
System.out.println("A OBEX connection has received.... ");
Bluetooth
for Java
return
ResponseCodes.OBEX_HTTP_OK;
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
}
ISBN:1590590783
The authors
of this text describe
public int
onGet(Operation
op)how
{ to develop wireless Java
applications
using
Bluetooth
for
a
variety
of platforms. This
try{
includes an API overview of the Java library, development of
//The
server services,
has received
request
for
Bluetooth-based
highlightsaof GET
security
concerns,
and client.
System.out.println("Received
a GET request from client.... . ");
more.
HeaderSet hdr = op.getReceivedHeaders();
Table of Contents
System.out.println("Server has received a request for the file "+
Bluetooth for Java(hdr.getHeader(HeaderSet.NAME)).toString());
Introduction
Chapter 1
String url = "file://name=" +
Chapter 2
- Introducing
Bluetooth
(hdr.getHeader(HeaderSet.NAME)).toString()
+ ";mode=r";
- Bluetooth
InputConnection
1.1
inpcon =
Chapter 3
(InputConnection)Connector.open(url);
- Before
You Get Started
Chapter 4
InputStream
in Bluetooth
= inpcon.openInputStream();
- Understanding
the Java
API
Chapter 5
byte[]
- Bluetooth
withfileAsBytes
J2ME MIDP
Chapter 6
in.read(fileAsBytes);
- Creating
a Bluetooth Print Server with JPS API
Chapter 7
read fully into the port.... ");
- JavaSystem.out.println("File
and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
-
Chapter 10 Chapter 11 Chapter 12 Appendix A -
= new byte[97];
for(int i =0; i<fileAsBytes.length; i++)
System.out.print((char)fileAsBytes[i]);
Bluetooth Security
DataOutputStream out = op.openDataOutputStream();
Wireless Embedded Systems with the Micro BlueTarget
out.write(fileAsBytes, 0, fileAsBytes.length);
Enterprise Bluetooth Applications with the Ericsson BlipNet
System.out.println("\n" + "File written back to client.... ");
Bluetooth and Jini
op.close();
javax.bluetooth
in.close();
Appendix B }- javax.obex
Appendix C catch(IOException
- Java Bluetooth Development
e){ on the PalmOS Platform
Appendix D - BlipNet
1.1 API
System.out.println(e.getMessage());
Index
}
List of Figures
catch(ArrayIndexOutOfBoundsException e){
List of Tables
System.out.println(e.getMessage());
}
List of Listings
List of Sidebars
return ResponseCodes.OBEX_HTTP_OK;
}
public static void main(String args[]) throws IOException {
FTServer server = new FTServer();
LocalDevice localDevice = LocalDevice.getLocalDevice();
SessionNotifier sn =
(SessionNotifier)Connector.open("btgoep://localhost:1106;name=FTP");
System.out.println("Waiting for a client connection.... . ");
sn.acceptAndOpen(server);
System.out.println("A Client now connected.... ");
}
}
More on Connection URLs and the SDDB
TheConnection URL and the service record attributes in the SDDB are closely related. Although software
Bluetooth for Java
developers may
not care about the inner details of the SDDB, this information will be helpful when searching
by remote
Bruce Hopkins
and
for services on
devices.
In Ranjith
the FileAntony
Transfer ServerISBN:1590590783
example, the SDDB gets populated with various
Apress
©
2003
(352
pages)
components of the connection URL: Connector.open("btgoep://localhost:1106;name=FTP");.
The authors of this text describe how to develop wireless Java
applications using
for a variety
of that
platforms.
ServiceRecordHandle
is aBluetooth
32-bit unsigned
integer
has anThis
attribute ID of 0x0000. This is a unique
includes
an API
of The
the Java
development of
identifier for each
service
in overview
the SDDB.
valuelibrary,
of ServiceRecordHandle
is generated internally and
Bluetooth-based services, highlights of security concerns, and
remains unique
throughout
the
database.
more.
ServiceClassIDList is a data sequence of UUIDs with an attribute ID of 0x0001. The underlying
Discovery Protocol (SDP) implementation generates this list with the first element as the UUID given
Table Service
of Contents
in
the
Connection
URL. In this example, the first UUID in this list will be 0x1106.
Bluetooth for Java
Introduction
ServiceRecordState is a 32-bit unsigned integer that has an attribute ID of 0x0002. The underlying SDP
- Introducing Bluetooth
implementation
automatically generates this attribute and changes its value when any modification occurs
Chapter
- Bluetooth
1.1
with2 this
service record.
Chapter 1
Chapter 3
- Before You Get Started
ProtocolDescriptorList
is a data sequence
of UUIDs (with optional parameters or protocol-specific
Chapter
4 - Understanding the Java Bluetooth
API
values)
with an attribute
ID of
0x0004. Once again, the SDP implementation automatically generates this
Chapter
5 - Bluetooth
with J2ME
MIDP
attribute
based on
the protocol
in Connection
URL. If the protocol is btl2cap, then
Chapter
6 - Creating
a Bluetooth
Printdescribed
Server with
JPS API
ProtocolDescriptorList
contains one protocol descriptor for L2CAP in addition to its Protocol Service
Chapter
7 - Java and OBEX
Multiplexer
(PSM) value. If the protocol is btspp, then the ProtocolDescriptorList contains two
- Using a Bluetooth Simulator
protocols, L2CAP and RFCOMM (in addition to the RFCOMM server channel). If the protocol is btgoep (as
Chapter 9 - Bluetooth Security
in this example), then the ProtocolDescriptorList contains three protocols: L2CAP, RFCOMM, and
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
GOEP.
Chapter 8
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter
12 - Bluetooth and Jini
ServiceDatabaseState
is a 32-bit unsigned integer with an attribute ID of 0x0201. Every modification to
Appendix
A - javax.bluetooth
the SDDB
affects the value of this attribute, and the SDP implementation will automatically take care of this
Appendix
B - javax.obex
for you.
Appendix C - Java Bluetooth Development on the PalmOS Platform
ServiceName is the friendly name by which the services are known to the devices in the vicinity. In this
example, the service name is FTP.
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
File Transfer Client
List of Sidebars
Now in order to access the File Transfer server, we must first perform device discovery and service discovery like
we always do in Bluetooth applications. In addition to that, in our serviceSearchCompleted() method, we
create our Operations and HeaderSets to instruct the OBEX server what we want to do.
The CONNECT Operation
The first OBEX operation that needs to be created and sent to the OBEX server is CONNECT. This is
accomplished by the following:
con = (ClientSession)Connector.open(serviceURL);
hdr = con.connect(hdr);
Theconnect() method of this ClientSession instance returns a HeaderSet object where we can inspect
and determine if our CONNECT operation was a success.
The GET Operation
Now that we have successfully performed our CONNECT operation, we are able to create other operations like
GET,PUT, and SETPATH. The code that you would use in order to create and send a GET operation to an OBEX
server looks like this:
Bluetooth for Java
hdr = con.createHeaderSet();
ISBN:1590590783
by Bruce Hopkins and Ranjith
Antony
hdr.setHeader(HeaderSet.TYPE,"
text/plain");
Apress
©
2003
(352
pages)
hdr.setHeader(HeaderSet.NAME," Hello.txt");
authors of this text describe how to develop wireless Java
Operation op The
= con.get(hdr);
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
If the operation was
successful, then just open up an InputStream, and read the data:
more.
InputStream in = op.openInputStream();
Table of Contents
Bluetooth for Java
Introduction
Now that
have an InputStream
in hand, you can save your file to disk.
Chapter
1 you
- Introducing
Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 4
- Understanding the Java Bluetooth API
The DISCONNECT
Operation
Chapter
3 - Before You Get
Started
Creating and sending a DISCONNECT operation is pretty simple. All you need to do is call the disconnect()
Bluetooth with J2ME MIDP
method of-the
ClientSession object:
Chapter 5
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
clientSession.disconnect(null);
Chapter
- Wireless
Embedded
Systems
with 7-2.
the Micro BlueTarget
The full10code
for FTClient
is show
in Listing
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Listing12
7-2:
FTClient.java
Chapter
- Bluetooth
and Jini
Appendix A - javax.bluetooth
Appendix
- javax.obex
importB java.io.*;
Appendix
- Java Bluetooth Development on the PalmOS Platform
importC java.util.*;
Appendix
importD javax.microedition.io.*;
- BlipNet 1.1 API
import javax.bluetooth.*;
Index
import
javax.obex.*;
List
of Figures
List of Tables
public
class FTClient implements DiscoveryListener {
List
of Listings
LocalDevice local = null;
List of Sidebars
DiscoveryAgent agent = null;
int[] attrSet = null;
RemoteDevice btDev = null;
String serviceURL = null;
ClientSession con = null;
HeaderSet hdr = null;
public FTClient() throws BluetoothStateException{
// initialize the stack, if needed
local = LocalDevice.getLocalDevice();
agent = local.getDiscoveryAgent();
agent.startInquiry(DiscoveryAgent.GIAC, this);
}
public void deviceDiscovered(RemoteDevice btDevice,DeviceClass cod){
btDev = btDevice;
System.out.println("Device discovered "+
btDevice.getBluetoothAddress());
}
public void servicesDiscovered(int transID, ServiceRecord[] servRecord){
System.out.println("Discovered a service.... ");
for(int i =0; i < servRecord.length; i++){
Bluetooth for Java
serviceURL
=
ISBN:1590590783
by Bruce Hopkins and Ranjith Antony
servRecord[i].getConnectionURL(ServiceRecord.NOAUTHENTICATE_NOENCRYPT,
Apress
©
2003
(352
pages)
true);
System.out.println("The service URL is "+ serviceURL);
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
}
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
public void
more. serviceSearchCompleted(int transID, int respCode){
}
System.out.println("Service search completed.......... . ");
System.out.println("Opening a connection with the server.... ");
Table of Contents
try{
Bluetooth for Java
con = (ClientSession)Connector.open(serviceURL);
Introduction
hdr = con.connect(hdr);
Chapter 1 - Introducing
Bluetooth
System.out.println("Response
code of the server after connect..." +
Chapter 2 - Bluetooth
hdr.getResponseCode());
1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
//Sending
a request
to server for file Hello.txt
- Bluetooth
with J2ME
MIDP
Chapter 6
hdr =a con.createHeaderSet();
- Creating
Bluetooth Print Server with JPS API
Chapter 7
hdr.setHeader(HeaderSet.TYPE,"
text/vCard");
- Java
and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
hdr.setHeader(HeaderSet.NAME," Hello.txt");
Operation op = con.get(hdr);
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
//The server is now sending the file
InputStream in = op.openInputStream();
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
// Writing the file from server to local file system.
Appendix
C - Java Bluetooth Development
on the
StreamConnection
filestream
= PalmOS Platform
Appendix D - BlipNet
1.1 API
(StreamConnection)Connector.open("file://name=HelloFile.txt;mode=w");
Index OutputStream out = filestream.openOutputStream();
List of Figures
//read and write the data
int data = in.read();
while(data != -1){
List of Sidebars
out.write((byte)data);
data = in.read();
}
// send the DISCONNECT Operation
con.disconnect();
List of Tables
List of Listings
// cleanup
op.close();
in.close();
out.close();
}
catch(IOException e){
System.out.println(e.getMessage());
}
}
public void inquiryCompleted(int discType){
System.out.println("Inquiry completed...");
UUID[] uuids = new UUID[1];
uuids[0] = new UUID("1106",true);
try{
if(btDev == null){
System.out.println("No device has been discovered, "+
Bluetooth
fornot
Javaworth proceeding, exiting.... ");
"hence
ISBN:1590590783
by
Bruce
Hopkins
and Ranjith Antony
System.exit(1);
Apress
©
2003
(352
pages)
}
The authors of this text describe
how to develop
Java
System.out.println("Now
searching
for wireless
services.......
. ");
applications
using
Bluetooth
for
a
variety
of
platforms.
This
agent.searchServices(attrSet, uuids, btDev, this);
includes an API overview of the Java library, development of
}
Bluetooth-based services, highlights of security concerns, and
catch(BluetoothStateException
e) {System.out.println(e.getMessage());}
more.
}
Table of
Contents
public
static void main(String args[]) throws IOException {
Bluetooth for
Java
FTClient
client = new FTClient();
Introduction
}
Chapter
1
}
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
More on
Operations
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter
7 we
- Java
and
OBEX
Now that
have
a full
working example of both an OBEX client and an OBEX server, let's look at what it takes
Chapter
8 - Using
a operations.
Bluetooth Simulator
to use other
OBEX
Chapter 9
- Bluetooth Security
The SETPATH
Chapter
10 - WirelessOperation
Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
TheSETPATH operation allows an OBEX client to make a request to an OBEX server to change its current
directory. The server is not required to obey the request, so the server is free to return an error to the client
Appendix A - javax.bluetooth
indicating that the request was rejected. The exact syntax for ClientSession.setPath() is
Chapter 12 - Bluetooth and Jini
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
public HeaderSet setPath(HeaderSet headers, boolean backup, boolean create)
Appendix D - BlipNet 1.1 API
Index
List
Figures
To of
specify
the name of the directory that you want to navigate to, you must create a HeaderSet with the name
List
setofasTables
a header. If you wanted to set the path to the previous directory (i.e. cd ..) then backup must be set to
List
of Listings
true.
If the directory does not exist, but you want it to be created, then you must set create to be true. The
List
code
of Sidebars
that follows demonstrates how to create a SETPATH operation:
HeaderSet folderHdr = clientSession.createHeaderSet();
folderHdr.setHeader(HeaderSet.NAME, "temp");
HeaderSet resultHdr = clientSession.setPath(folderHdr, false, true);
The PUT Operation
After creating and sending a CONNECT operation, creating a PUT operation is very straightforward as shown in the
code presented here:
hdr = con.createHeaderSet();
String filename = "resume_cv.txt";
// setting values
hdr.setHeader(HeaderSet.NAME, fileName);
hdr.setHeader(HeaderSet.TYPE," text/plain");
// creating and sending the PUT Operation
Operation op = con.put(hdr);
// sending the BODY
for Java
OutputStream Bluetooth
writeStrm
= op.openOutputStream();
ISBN:1590590783
by
Bruce
Hopkins
Ranjith Antony
StreamConnection strmCon and
= (StreamConnection)Connector.open("file://name="
+
Apress
©
2003
(352
pages)
fileName + ";mode=r");
The authors of
text describe how to develop wireless Java
InputStream readStrm
= this
strmCon.openInputStream();
applications
using
Bluetooth
for a variety of platforms. This
byte[] block = new byte[512];
includes an API overview of the Java library, development of
int dataSize Bluetooth-based
= -1;
services, highlights of security concerns, and
while((dataSize
more.= readStrm.read(block))!= -1) {
writeStrm.write(block, 0, dataSize);
}
Table of Contents
Bluetooth
for Java
readStrm.close();
Introduction
// setting final bit and
Chapter
1 - Introducing
Bluetooth
// sending
the END-OF-BODY-HEADER
Chapter
writeStrm.close();
2 - Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Summary
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
OBEX (which stands
for©OBject
EXchange)
is a powerful, transport agnostic, communication protocol that
Apress
2003 (352
pages)
allows the transmission
of
objects
between
clients
and
The OBEX
protocol is an adopted protocol
The authors of this text describe how
to servers.
develop wireless
Java
in the Bluetooth specification,
and
originally
gets
its
roots
from
the
IrDA
specification.
This chapter helped
applications using Bluetooth for a variety of platforms. This
an API
overview
of the
library,semantics
development
of
you to get familiarincludes
with many
of the
concepts
of Java
the OBEX
including
headers, operations, and
services,
of security
concerns,
and javax.obex API, and also
response codes. Bluetooth-based
This chapter gave
you anhighlights
introduction
of the classes
in the
more.
provided a working example on how to send files between wireless devices.
OBEX opens the door to a world of powerful wireless applications by providing Bluetooth developers with
the ability to send files between devices. In the next chapter, we'll change gears a bit and discuss how to
Bluetooth for Java
simulate a Bluetooth network.
Table of Contents
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
for Java
Chapter Bluetooth
8: Using
a Bluetooth Simulator
ISBN:1590590783
by Bruce Hopkins and Ranjith Antony
Overview
Apress © 2003 (352 pages)
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
Okay, we have toincludes
admit it:an
If you're
API overview
new toofBluetooth,
the Java library,
developing
development
wirelessofclient/server code can
Bluetooth-based
services,
security
concerns,
(sometimes) be rather
inconvenient.
After highlights
writing theofclient
code
and thenand
the server code, you may have
more.
to do a lot of debugging to get things working properly. Maybe your logic is incorrect—perhaps you have a
problem with one of your Bluetooth modules (maybe both of them). With so many points of failure, it can
be aof
real
daunting task to debug even the simplest Bluetooth application. However, with the help of a
Table
Contents
Bluetooth
network
Bluetooth for
Java simulator, all of the hardware and its underlying complexities are abstracted, and this
will
enable
you
to focus more time and effort to debug your application code.
Introduction
Chapter
1 A
- Introducing
Bluetooth
Note
Bluetooth network
simulator can also be helpful if you're on a budget or if you're a student. If
Chapter 2 either
- Bluetooth
case 1.1
applies to you, you certainly don't have a lot of money to buy a test lab full of
Chapter 3 Bluetooth
- Before You
Get Started
devices.
Chapter 4 - Understanding the Java Bluetooth API
This chapter
is all about
to MIDP
use a Bluetooth network simulator in your application development
Chapter
5 - Bluetooth
withhow
J2ME
process.
simulator
isn't with
a panacea
Chapter
6 A- Bluetooth
Creating anetwork
Bluetooth
Print Server
JPS API for all of your development woes, but it can be a
very useful
many
areas of the wireless application development life cycle. We'll start this chapter off
Chapter
7 - tool
Javainand
OBEX
by explaining
the difference between a simulator and an emulator, just in case you didn't know that there's
- Using a Bluetooth Simulator
a difference. Next, we'll take a look at the pros and cons of using a simulator. In the rest of the chapter,
Chapter 9 - Bluetooth Security
we'll get you up to speed on how to use the first and only Bluetooth network simulator in which you can
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
execute your JSR-82-compatible code: the Rococo Impronto Simulator.
Chapter 8
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter
12 This
- Bluetooth
Jini
Note
chapterand
is intended
to provide a brief overview of the concepts of simulation and the Rococo
Appendix A software.
- javax.bluetooth
For more detailed information on how to use the Rococo Impronto Simulator, be sure
Appendix B to
- javax.obex
read the user manual.
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
Difference Between a Simulator and an Emulator
List of Tables
Is there a difference between a simulator and an emulator? Yes, definitely. An emulator is a
software program (or sometimes a hardware device) that emulates the functionality of another
List of Listings
computer system. Behind the scenes, the emulator translates the instructions of the device
List of Sidebars
being emulated to the machine code of the foreign system. Essentially, only computers can
emulate other computers, and due to the translation process, emulation works best when a
faster computer emulates a slower computer. Emulators are handy when you want to run a
program, but the computing system for which it was originally designed no longer exists or isn't
available. For instance, the Multiple Arcade Machine Emulator (MAME) project is a popular
emulator that allows you to play classic arcade games on your desktop computer. PalmSource
also makes an emulator that allows you to run different versions of the Palm OS on your
desktop computer. This can be useful when testing to see if your code is backward compatible
with older versions of the Palm OS.
On the other hand, a simulator is something (usually software) that represents the functionality
of an entire system. A simulator will mimic the interaction and communication process between
devices in the system, and try to display the results as if those occurrences actually happened.
For instance, an automotive company can create a crash test simulator. Using this simulator, the
automotive engineer can simulate what would happen to the car if it collides with another object
like a wall, a deer, or even another car. Now, in order for the simulator to be even remotely
useful, formulas must exist that describe the interaction of the objects in the system. If such
formulas do not exist, then a lot of mapping and modeling of the objects in the system need to
be done ahead of time before the simulator is created.
With the use of a Bluetooth network simulator, you can mimic the interaction of multiple
Bluetooth devices on your desktop computer as if those occurrences were actually happening
between Bluetooth devices.
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth
forof
Java
The Pros and
Cons
Using a Simulator
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
A Bluetooth simulator
can
be a(352
useful
Apress
© 2003
pages)and beneficial tool. One of the major benefits of a Bluetooth
network simulatorThe
is that
it
allows
you
to describe
work on how
yourtoapplication
code without
authors of this
text
develop wireless
Java worrying about setting up
and administrating
your
Bluetooth
hardware
configurations.
This
enables
applications using Bluetooth for a variety of platforms. This you to create quick proof of
includesverification.
an API overview
of the
Java library,teams,
development
concepts and algorithm
In larger
development
the useofof a simulator can greatly
Bluetooth-based
highlights
of security
and
reduce the expense
of creating a services,
development
environment
forconcerns,
each developer.
Instead of buying
more.
Bluetooth hardware for each and every individual (which would be used throughout all the phases of the
application development life cycle), fewer Bluetooth devices can be purchased and used for only the final
phase
application development: testing.
Table
of of
Contents
Bluetooth for Java
Now, on the other hand, no matter how good a Bluetooth network simulator may claim to be, it is no
substitute for scenarios that require the presence of real Bluetooth hardware. For instance, a Bluetooth
Chapter 1 - Introducing Bluetooth
network simulator isn't capable of telling you what would happen if you ran your file transfer application
Chapter 2 - Bluetooth 1.1
code using 3Com or TDK Bluetooth modules. A Bluetooth network simulator is also incapable of telling
Chapter
3 your
- Before
You Getwould
Started
you how
application
behave in the presence of other devices that operate in the 2.4 GHz range
Chapter
4
Understanding
the
Javaovens.
Bluetooth
like WLAN devices or microwave
DueAPI
to the absence of any Bluetooth hardware, Bluetooth
Chapter
5
Bluetooth
with
J2ME
MIDP
network simulators are also a poor choice for testing the performance of your application (such as I/O
Chapter
6 - Creating a Bluetooth Print Server with JPS API
throughput).
Introduction
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for from
Java Rococo
Impronto Simulator
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
The Rococo Impronto
a 100 percent Java application that allows you, the developer, to create JSR-82ApressSimulator
© 2003 (352ispages)
compliant Bluetooth
applications.
Using
the Impronto
Simulator,
you canJava
create virtual Bluetooth devices using the
The authors of this text describe
how to
develop wireless
environment, andapplications
deploy yourusing
codeBluetooth
to those for
virtual
devices
to
see
how
they
a variety of platforms. This interact.
includes an API overview of the Java library, development of
Bluetooth-based
services,
highlights
security
concerns,
and
Note Using the
Rococo Impronto
Simulator,
youofcan
create
Bluetooth
applications for both the J2ME and J2SE
more.
platforms. Note that J2SE Bluetooth applications will not be JSR-82 compliant until the GCF for J2SE is
released.
Table of Contents
Product Features
Bluetooth for Java
Introduction
The following
features are
supported by the Rococo Impronto Simulator:
Chapter
1 - Introducing
Bluetooth
Chapter 2
- Bluetooth 1.1
Provides
full support for L2CAP, RFCOMM, OBEX, SDP, and HCI protocols
Chapter 3
- Before You Get Started
Chapter
Provides
4 - Understanding
a management
the console
Java Bluetooth
for tracking
API and controlling the runtime behavior of simulated devices
Chapter 5
- Bluetooth with J2ME MIDP
Runs JSR-82
code on simulated Bluetooth devices
- Creating a Bluetooth Print Server with JPS API
Chapter 6
Chapter
7 full
- Java
and capability
OBEX
Has
logging
for Bluetooth events, and can capture events for specific devices with event filtering
Chapter 8 - Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Installation Guide
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter
11 - Enterprise
Bluetooth
with the Ericsson
BlipNet
The Impronto
Simulator
runs onApplications
any J2SE environment,
including
Windows and Linux. You can obtain a free trial of
Chapter
12
Bluetooth
and
Jini
the software from the Rococo Web site http://www.rococosoft.com. In order to install the software on
Appendix
A 2000,
- javax.bluetooth
Windows
just execute simulator.exe. When installing the software on UNIX platforms, you need to execute
Appendix
B - javax.obex
simulator.bin.
The Simulator requires at least 64 MB of RAM and 5 MB of free disk space. Figure 8-1 is a screenshot
Appendix
C - Java Bluetooth
of the installation
program.Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Figure 8-1: The Rococo Impronto Simulator version 1.1 installation screen
In order to verify that your installation went smoothly, you should try to build the example applications that are
included with the Impronto Simulator: Echo,Chat, and AirHockey. First, you should open a command prompt and
run the setEnvVars script. On Windows platforms, this file is located at
{simulator_home}\bin\setEnvVars.bat
On UNIX platforms, the file is located at
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
{simulator_home}/bin/setEnvVars.sh
Apress © 2003 (352 pages)
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
After the script has
executed successfully, navigate to the examples directory and type ant at the command prompt
includes an API overview of the Java library, development of
to build the examples.
Bluetooth-based services, highlights of security concerns, and
more.
Note Just in case you didn't notice, the Apache Ant build utility was installed with the Impronto Simulator.
The of
final
step is to start up the Simulator Console. All you need to do is go back to the bin directory and execute
Table
Contents
manager.
screenshot of the Simulator Console is shown in Figure 8-2.
Bluetooth
forAJava
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List ofFigure
Tables 8-2: The Rococo Impronto Simulator Console
List of Listings
List of Sidebars
Working with the Simulator Console
The Simulator Console is the control panel to the Impronto Simulator. Using the Simulator Console, you can create
and edit simulated Bluetooth devices. The characteristics of each device that you create are stored in an XML file in
theconfig directory. For instance, to create a new Bluetooth device, just go to the File menu and select New
Device as shown in Figure 8-3.
Figure 8-3: Creating a new Bluetooth device in the Simulator Console is pretty simple.
The Impronto Simulator then gives you the option to set other properties for your simulated Bluetooth device such as
the address, the connectable mode, the friendly name, and the device class. Figure 8-4 shows a cell phone being
configured in the Simulator Console.
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Figure
Configuring
Chapter
9 - 8-4:
Bluetooth
Securitya cell phone in the Simulator environment
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter
11 friendly
- Enterprise
Bluetooth
Applications
with the the
Ericsson
BlipNet
Since the
name
of the device
is mydevice,
Console
will generate a file named mydevice.xml in the
Chapter
config
12directory.
- Bluetooth and Jini
Appendix A - javax.bluetooth
The contents of mydevice.xml are shown in Listing 8-1.
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Listing 8-1: mydevice.xml
Appendix D - BlipNet 1.1 API
Index
<device bluetoothAddress="01234567e012"
friendlyName=" mydevice"
List of Tables
isConnectable=" true"
List of Listings
deviceClass=" Phone/Cellular"
List of Sidebars
serviceClasses=" Audio,Telephony"
discoveryMode=" Not discoverable"
securityMode=" Never enforce security">
</device>
List of Figures
Running an Application in the Simulator
Okay, now that you've set up your environment, let's see what it takes to get your code running within the Impronto
Simulator environment. In order to link your application code to the virtual Bluetooth devices that you've created, you
need to specify an improntolocaldevice.friendlyname property for your application. In the J2SE, you can do
this by executing the following line of code at runtime:
java -Dimprontolocaldevice.friendlyname=TestPDA RemoteControl
That's of course assuming that the name of your application is RemoteControl and the friendly name of your virtual
device is TestPDA. You can also specify this property within your Java class itself before calling any JSR-82 code:
System.setProperty("improntolocaldevice.friendlyname", "TestPDA");
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
2003 (352
pages)
If you're creating Apress
a J2ME© MIDP
application,
you can set this property in your MIDlet's Java Application Descriptor
(JAD) file. For example,
the JAD
filetext
would
contain
the
line: Java
The authors
of this
describe
how
to following
develop wireless
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
impronto.localdevice.friendlyname:
fooof security concerns, and
Bluetooth-based services, highlights
more.
You must also insert the following code into your MIDlet's constructor so that Impronto Simulator can read the JAD
Table
of Contents
file using
the getAppProperty() method of MIDlet:
Bluetooth for Java
Introduction
import com.rococosoft.impronto.configuration.*;
Chapter
1 javax.microedition.midlet.*;
- Introducing Bluetooth
import
Chapter
2 class
- Bluetooth
1.1
public
SomeMIDlet
extends MIDlet
Chapter
3 - Before
You Get Started
public
SomeMIDlet()
{
Chapter 4 Configuration.setConfiguration
- Understanding the Java Bluetooth API
(new MIDPConfigurationImpl(this));
Chapter }
5
- Bluetooth with J2ME MIDP
... 6
Chapter
- Creating a Bluetooth Print Server with JPS API
}
Chapter
7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Note Any application that uses pure JSR-82 code (i.e., no vendor libraries) can run in the simulator as well. The
only downside is that the simulator will create generic "dummy" devices.
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Chat Example
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
The chat example we present here uses the Serial Port Profile to send text messages from one simulated Bluetooth
Appendix
- BlipNet In
1.1
API
device toDanother.
ChatServer.java,
the chat server registers its service and waits for a client to connect. After
Index
a client connects, the server prints the client's message to the command line and prompts the server to respond. In
List
of Figures
ChatClient.java,
the client searches for the server and creates a Serial Port Profile connection after obtaining
List
Tables
theofconnection
URL. Listing 8-2 shows the code for ChatServer.java and Listing 8-3 shows the code for
List
ChatClient.java.
of Listings
List of Sidebars
Listing 8-2: ChatServer.java
import java.io.*;
import javax.bluetooth.*;
import com.rococosoft.io.*;
class Server {
StreamConnection con = null;
StreamConnectionNotifier service= null;
InputStream ip = null;
OutputStream op = null;
String serviceURL = "btspp://localhost:1111;name=ChatServer";
public Server() throws IOException{
//Extends a stream for client to connect
service = (StreamConnectionNotifier)Connector.open(serviceURL);
//Server waiting for client to connect
con = service.acceptAndOpen();
//Open streams for two way communication.
ip = con.openInputStream();
op = con.openOutputStream();
Bluetooth
forfor
Javareading data from inputstream
//Starts a new
thread
by
Bruce
Hopkins
and Ranjith
Antony
//while the present thread,
goes forward
and ISBN:1590590783
write data to outputstream
Apress
©
2003
(352
pages)
//thus enabling a two way communication with the client
authors=ofnew
this text
describe how to develop wireless Java
ReadThreadTherdthr
ReadThread(ip);
applications
using
Bluetooth
for a variety of platforms. This
rdthr.start();
includes an API overview of the Java library, development of
writeData();
Bluetooth-based services, highlights of security concerns, and
}
more.
private void writeData() throws IOException{
int data = 0;
Table do{
of Contents
Bluetooth
for Java
try{
Introduction
data = System.in.read();
Chapter
1 - Introducing Bluetooth
op.write(data);
Chapter
}catch(IOException
2 - Bluetooth 1.1
e){}
}while(true);
Chapter
3 - Before You Get Started
} 4 - Understanding the Java Bluetooth API
Chapter
}
Chapter
5 - Bluetooth with J2ME MIDP
class6 ReadThread
extends
Thread
{ JPS API
Chapter
- Creating a Bluetooth
Print
Server with
InputStream
= null;
Chapter
7 - Java and ip
OBEX
public ReadThread(InputStream inp){
Chapter 8 - Using a Bluetooth Simulator
ip = inp;
Chapter 9 - Bluetooth Security
}
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
public void run() {
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
char data;
Chapter 12 - Bluetooth and Jini
int i = 0;
Appendix
do{A - javax.bluetooth
Appendix
B - javax.obex
try{
Appendix
- Java from
Bluetooth
Development
//ReadC data
the
stream on the PalmOS Platform
Appendix
D
BlipNet
1.1
API
data = (char)ip.read();
IndexSystem.out.print(data);
List
//This
of Figures
is a bit sneaky and hard to explain.
//comment
List
of Tables out the following line to see the difference in how
//the
application behaves.
List
of Listings
List ofif(data
Sidebars == 0x0d)System.out.println();
}
catch(IOException e){}
}while(true);
}
}
public class ChatServer {
public static void main(String args[]) throws IOException {
System.setProperty("improntolocaldevice.friendlyname", "ChatServer");
Server chatServer = new Server();
}
}
Listing 8-3: ChatClient.java
import java.io.*;
import javax.bluetooth.*;
import com.rococosoft.io.*;
class Client implements DiscoveryListener{
Bluetooth
for Java localDevice = null;
private static
LocalDevice
by Bruce Hopkins
and Ranjith Antony = null;ISBN:1590590783
private DiscoveryAgent
discoveryAgent
Apress
© 2003 (352 pages) = null;
private String
connectionURL
private RemoteDevice[]
device
= null;
The authors of this
text describe
how to develop wireless Java
applications usingrecords
Bluetooth =
for null;
a variety of platforms. This
private ServiceRecord[]
includes
an API overview=offalse;
the Java library, development of
private boolean
inquiryCompl
Bluetooth-based services, highlights of security concerns, and
int count = 0;
more.
int maxSearches = 10;
InputStream ip = null;
Table
of Contents op = null;
OutputStream
Bluetooth
public for
Client()
Java
throws IOException, InterruptedException{
localDevice = LocalDevice.getLocalDevice();
Introduction
discoveryAgent
= localDevice.getDiscoveryAgent();
Chapter
1 - Introducing Bluetooth
device
=
new
RemoteDevice[10]
Chapter 2 - Bluetooth 1.1
// Starts
inquiry
for
devices in the proximity and waits till the
Chapter
3 - Before
You Get
Started
//inquiry
is
completed.
Chapter 4 - Understanding the Java Bluetooth API
System.out.println("\nSearching for Devices...\n");
Chapter 5 - Bluetooth with J2ME MIDP
discoveryAgent.startInquiry(DiscoveryAgent.GIAC,this);
Chapter 6 - Creating a Bluetooth Print Server with JPS API
synchronized(this){
Chapter 7 - Java and OBEX
this.wait();
Chapter 8 - Using a Bluetooth Simulator
}
Chapter 9
- Bluetooth Security
Chapter
10 the
- Wireless
Embedded
Systems
the Micro BlueTarget
//Once
Device
inquiry
is with
completed
it starts searching for the
Chapter
11
Enterprise
Bluetooth
Applications
with
the Ericsson
BlipNet
//required service. Service search is
done with
the given uuid.
Chapter
12 -starting
Bluetooth and
Jini search it waits for the result. If the
//After
each
Appendix
A - javax.bluetooth
//connectionURL
is null, ie, if No service Records are obtained, then
Appendix
B - javax.obex
//it continues
search in the next device detected.
Appendix C - Java Bluetooth Development on the PalmOS Platform
int[]
attrSet
= {0,3,4,0x100};
Appendix
D - BlipNet
1.1 API
IndexUUID[] uuids = new UUID[1];
= new UUID("1111",true);
List ofuuids[0]
Figures
i = 0; i< count;i++) {
List offor(int
Tables
transactionid = discoveryAgent.searchServices
List ofint
Listings
List of Sidebars
(attrSet,uuids,device[i],this);
if(transactionid != -1){
synchronized(this){
this.wait();
}
}
if(connectionURL != null)
break;
}// end of forloop
//If the URL returned from SPP Server begins with btspp then
//we call the getConnection method which
//establishes a connection with the SPPServer and returns it. Connection
// returned is of type StreamConnection.
//A piece of raw data is being sent over RFCOMM.
if(connectionURL == null)
System.out.println("No service available.......... .");
else if(connectionURL.startsWith("btspp")){
StreamConnection connection = getconnection();
op = connection.openOutputStream();
ip = connection.openInputStream();
}
Bluetooth
WriteThread
wrthr for
= Java
new WriteThread(op);
by
Bruce
Hopkins
and Ranjith Antony
wrthr.start();
Apress
©
2003
(352
pages)
readData();
ISBN:1590590783
The authors of this text describe how to develop wireless Java
}
using Bluetooth
for a variety of platforms. This
private void applications
readData()throws
IOException{
includes an API overview of the Java library, development of
char data;Bluetooth-based services, highlights of security concerns, and
int i = 0;more.
do{
data = (char)ip.read();
Table System.out.print(data);
of Contents
Bluetooth
for Java== 0x0d)System.out.println();
if(data
Introduction
}while(true);
Chapter
1 - Introducing Bluetooth
}
Chapter 2
- Bluetooth 1.1
//When
device
it is added to the remote device table.
Chapter
3 a- Before
Youis
Get discovered
Started
Chapter 4
- Understanding the Java Bluetooth API
public
void
deviceDiscovered(RemoteDevice btDevice, DeviceClass cod)
Chapter
5 synchronized
- Bluetooth with J2ME
MIDP
{
Chapter
6
- Creating a Bluetooth Print Server with JPS API
System.out.println("New
Device discovered : "+btDevice.getBluetoothAddress());
Chapter
7 - Java and OBEX
device[count++]
= btDevice;
- Using a Bluetooth Simulator
Chapter 8
}
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
//When a service is discovered in a particular device
// and the connection url is not null //then the thread that
Appendix
A - javax.bluetooth
//is waiting
in the main is notified.
Chapter 12 - Bluetooth and Jini
Appendix B - javax.obex
Appendix
- Java Bluetooth Development
on the PalmOS Platform
publicC synchronized
void servicesDiscovered(int
transID,
Appendix D - BlipNet 1.1 API
ServiceRecord[] servRecords) {
Indexrecords = new ServiceRecord[servRecords.length];
List ofrecords
Figures
= servRecords;
i=0;i<servRecords.length;i++) {
List offor(int
Tables
List ofint[]
Listings atrids = servRecords[i].getAttributeIDs();
List ofString
Sidebars servName = (String)((DataElement)
servRecords[i].getAttributeValue(0x100)).getValue();
System.out.println("Service Name : "+servName);
connectionURL = servRecords[i].getConnectionURL
(ServiceRecord.NOAUTHENTICATE_NOENCRYPT,true);
System.out.println("Connection url :" + connectionURL);
if(connectionURL != null) {
synchronized(this) {
this.notify();
}
break;
}
}
}
//This function notifies the Thread waiting in main if a service search is
// terminated, i.e., if the responsecode is SERVICE_SEARCH_COMPLETED or
//SERVICE_SEARCH_NO_RECORDS
public synchronized void serviceSearchCompleted(int transID, int respCode) {
if(respCode==SERVICE_SEARCH_ERROR)
System.out.println("\nSERVICE_SEARCH_ERROR\n");
if(respCode==SERVICE_SEARCH_COMPLETED)
Bluetooth for Java
System.out.println("\nSERVICE_SEARCH_COMPLETED\n");
ISBN:1590590783
by Bruce Hopkins and Ranjith Antony
if(respCode==SERVICE_SEARCH_TERMINATED)
Apress
©
2003
(352
pages)
System.out.println("\n SERVICE_SEARCH_TERMINATED\n");
The ==
authors
of this text describe how to develop wireless Java
if(respCode
SERVICE_SEARCH_NO_RECORDS){
applications
using
synchronized(this) { Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
this.notify();
Bluetooth-based services, highlights of security concerns, and
}
more.
System.out.println("\n SERVICE_SEARCH_NO_RECORDS\n");
}
Table if(respCode
of Contents
== SERVICE_SEARCH_DEVICE_NOT_REACHABLE)
Bluetooth
for Java
System.out.println("\n
SERVICE_SEARCH_DEVICE_NOT_REACHABLE\n");
Introduction
}
Chapter
1 the
- Introducing
//Once
deviceBluetooth
inquiry is completed it notifies the Thread that waits in the Main.
Chapter
public
2 - Bluetooth
synchronized
1.1
void inquiryCompleted(int discType)
{
this.notify();
Chapter
3 - Before You Get Started
} 4 - Understanding the Java Bluetooth API
Chapter
StreamConnection
getconnection()
throws IOException {
Chapter
5 - Bluetooth with J2ME
MIDP
return
(StreamConnection)Connector.open(connectionURL);
Chapter
6 - Creating
a Bluetooth Print Server with JPS API
} 7 - Java and OBEX
Chapter
}
Chapter 8 - Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
class WriteThread extends Thread {
Appendix
A - javax.bluetooth
OutputStream
op = null;
Appendix
B
- javax.obex
public
WriteThread(OutputStream oup){
Appendix
Java Bluetooth Development on the PalmOS Platform
op C
= -oup;
Appendix
} D - BlipNet 1.1 API
Indexpublic void run() {
List ofint
Figures
data = 0;
i =
List ofint
Tables
0;
List ofdo{
Listings
List oftry{
Sidebars
data = System.in.read();
op.write(data);
}catch(IOException e){}
}while(true);
}
}
public class ChatClient {
public static void main(String args[]) throws IOException,InterruptedException
{
System.setProperty("improntolocaldevice.friendlyname", "ChatClient");
Client chatClient = new Client();
}
}
In order to test the application, you need to set the system properties for each class. Figure 8-5 shows the Impronto
Simulator after we ran the ChatServer application.
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
Table of Contents
Figure
Bluetooth
for 8-5:
Java The ChatServer Bluetooth device in the Impronto Simulator device list
Introduction
Chapter
1 the
- Introducing
Bluetooth
Now that
server is running,
let's open a new command window and run the chat client. Figure 8-6 shows the
Chapter
2 Simulator
- Bluetoothwith
1.1ChatClient making a connection to ChatServer.
Impronto
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
Figure 8-6: The ChatServer interacting with the ChatClient in the Impronto Simulator environment
List of Figures
List of Tables
And
it! You now have a complete simulated JSR-82 application. Figures 8-7 and 8-8 show the conversation
List
of that's
Listings
between
the client and the server.
List
of Sidebars
Figure 8-7: The server has sent a message and the client responds.
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
Table of Contents
Bluetooth
for 8-8:
Java The client receives a message and sends a reply.
Figure
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Summary
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
This chapter gaveApress
you an
introduction
© 2003
(352 pages)to the Rococo Impronto Simulator, the first and only development
environment that The
allows
you
to
JSR-82-compliant
applications
using
authors of create
this text
describe how to develop
wireless
Javasimulated Bluetooth devices.
Bluetooth simulators
are
very
useful
tools
in
the
application
development
applications using Bluetooth for a variety of platforms. This process because they allow you
includes
an API overview
of the
Java library,
of
to avoid configuring
or debugging
Bluetooth
devices
in your development
test environment.
Bluetooth-based services, highlights of security concerns, and
more.
In Chapter 9, we're
going to discuss the security measures that are provided by the Bluetooth specification
and the JSR-82 in order to make your applications more secure.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
for Java
Chapter Bluetooth
9: Bluetooth
Security
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
Apress ©the
2003
(352 pages)
So far, we've discussed
benefits
and the advantages of using Java and Bluetooth, but we haven't addressed (in
The
authors
of
this of
text
describe
how to develop
wireless
Javaother people from using your Bluetooth
any detail) the security implications
using
this technology.
What
prevents
applications using Bluetooth for a variety of platforms. This
devices? What prevents a hacker from intercepting your transmission if you're transmitting sensitive information like
includes an API overview of the Java library, development of
financial, personal,
or medical data?
In thishighlights
chapter, of
we'll
take a
look at the
Bluetooth-based
services,
security
concerns,
andsecurity measures built into the Bluetooth
specification and more.
the JSR-82 API in order to make your wireless applications more secure. We'll wrap things up with a
demonstration of how to use the Mobiwave Bluetooth Protocol Analyzer in order to see "what's in the air" when you're
transmitting data between Bluetooth devices.
Table of Contents
Bluetooth for Java
Bluetooth Security Measures
Introduction
Chapter
1 - Introducing
Bluetooth
Data security
is an important
aspect of any networked application. All data that is in transit is vulnerable to an attack
Chapter
- Bluetooth 1.1
from an2 eavesdropper
(it doesn't matter if the connections are physical or wireless). Developers must realize that there
Chapter
3 to
- Before
You Get
Started
is no way
completely
ensure
that information transmitted wirelessly will only reach the intended destination.
Chapter 4 - Understanding the Java Bluetooth API
Note
exceptwith
for infrared...but
Chapter
5 Well,
- Bluetooth
J2ME MIDP of course, you already knew that!
Chapter 6
- Creating a Bluetooth Print Server with JPS API
For application developers, the Bluetooth specification addresses security in three ways: authentication, authorization,
- Java and OBEX
and encryption. Let's look at these in more detail.
Chapter 7
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Authentication
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Authentication with Bluetooth consists of a simple challenge/response mechanism. The Bluetooth specification does
not provide any means to authenticate users; you can only authenticate devices. So, the challenge/response does not
Appendix
- javax.bluetooth
involve aAuser
name and password as typical authentication schemes. Authentication with Bluetooth only involves a
Appendix
B
- javax.obex number (PIN).
personal identification
Chapter 12 - Bluetooth and Jini
Appendix C - Java Bluetooth Development on the PalmOS Platform
During the
Appendix
D -authentication
BlipNet 1.1 APIprocess, the PIN code is never transmitted from the client to the server. In order to
authenticate, the client creates a 128-bit shared link key, which is derived from the PIN. If the PIN codes on the client
Index
andofthe
server do not match, then the authentication process fails.
List
Figures
List of Tables
A practical example for the usage of Bluetooth authentication would be a Bluetooth-enabled hotel business center. A
hotel that's oriented to business travelers could enable authentication on all of its Bluetooth-enabled devices (like
List
of Sidebars
printers
and scanners) in the business center. Upon check-in, a registered guest of the hotel will be given the PIN code
in order to access the services in the business center, and this would prevent non-hotel customers from simply walking
up and using the services that are reserved for hotel guests.
List of Listings
Server Authentication
Bluetooth servers can request authentication by adding the authenticate parameter to the connection URL
String. The code that follows shows a server using the Serial Port Profile, and requesting authentication:
String url = "btspp://localhost:00112233445566778899AABBCCDDEEFF;authenticate=true"
If the authenticate parameter is set to true, then the JSR-82 implementation attempts to enforce authentication
when devices connect to the server.
Note The key word here is attempt.
ABluetoothConnectionException will be thrown if the server does not support authentication, or if
there is a conflict with the settings of the BCC. It is ultimately the decision of the BCC to allow authentication
or to throw the exception. If the server device has a user interface, then the device may prompt the user to
change the device's settings.
If the authenticate parameter is set to false, then the implementation does not attempt to authenticate the client.
If the authenticate parameter is not in the URL String at all, then the implementation treats it as false, unless
for Java
you set encryptBluetooth
or authorize
to true.
Client
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
Authentication
ISBN:1590590783
The authors of this text describe how to develop wireless Java
using the
Bluetooth
a variety of platforms.
Bluetooth clients applications
can also require
server for
to authenticate
by settingThis
the authenticate parameter to true as
includes an API overview of the Java library, development of
shown here:
Bluetooth-based services, highlights of security concerns, and
more.
String url = "btspp://02AB45AC35DF:00112233445566778899AABBCCDDEEFF;authenticate=true"
Table of Contents
Bluetooth
If the authenticate
for Java
parameter is set to false (or is not in the URL at all), then the client will not require the server
Introduction
to authenticate.
Chapter 1
- Introducing Bluetooth
Chapter 4
- Understanding the Java Bluetooth API
Note Why would the client request the server to authenticate it (especially if the server didn't require
Chapter 2 - Bluetooth 1.1
authentication)?Well, since authentication is a requirement for encryption, the client may want to be
Chapter 3 - Before You Get Started
authenticated to the server in order to send some data securely, even though the server doesn't require it.
Chapter
5 you're
- Bluetooth
with
MIDP
Whether
a client
or J2ME
a server,
you can request authentication even after the connection is established, as shown
Chapter
6
Creating
a
Bluetooth
Print Server with JPS API
here:
Chapter 7
- Java and OBEX
Chapter
8 an
- Using
a Bluetooth
// get
instance
of Simulator
the RemoteDevice if we don't already have it
Chapter
9 - Bluetooth
Security
// assume
that we
have an active Connection object named "conn"
Chapter
10 - Wireless
Embedded Systems
with the Micro BlueTarget
RemoteDevice
remoteDevice
= RemoteDevice.getRemoteDevice(conn);
Chapter
11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
remoteDevice.authenticate();
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
The JSR-82 API also gives you a method to check to see if your Connection to a RemoteDevice is authenticated.
Just call the isAuthenticated() method of RemoteDevice.
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix
- BlipNet
API that in both client and server authentication, the PIN is never specified in the URL (or
NoteD Have
you1.1
noticed
Index
anywhere else)? Assigning and entering the PINs on both the client and server are handled by the BCC.
List of Figures
List of Tables
Bluetooth Server Authorization
List of Listings
List
of Sidebars
Bluetooth
servers can request that only authorized devices connect and use a particular service. These authorized
devices are called trusted devices.
Servers can require that clients be authorized by setting the authorize parameter to true in the connection URL, as
shown here:
String url = "btspp://02AB45AC35DF:00112233445566778899AABBCCDDEEFF;authorize=true"
Authorization requires authentication, so the following line of code is more descriptive of what's actually going on:
String url =
"btspp://02AB45AC35DF:00112233445566778899AABBCCDDEEFF;
authenticate=true;authorize=true"
However, if you explicitly set authenticate to false, and authorize to true, then the system will throw a
BluetoothConnectionException. If authorization was not specified in the connection URL, the server can require
the client to be authorized by calling the authorize() method of the RemoteDevice class as follows:
// get an instance of the RemoteDevice if we don't already have it
// assume that we have an active Connection object named "conn"
RemoteDevice remoteDevice = RemoteDevice.getRemoteDevice(conn);
Bluetooth for Java
remoteDevice.authorize(conn);
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
Whether the connection
is established
not, thehow
server
can check
to see
if the client is a trusted device by calling the
The authors
of this textordescribe
to develop
wireless
Java
applications
using
for a variety class.
of platforms. This
isTrustedDevice()
method
of Bluetooth
the RemoteDevice
includes an API overview of the Java library, development of
services,
highlights of security
concerns,
Note There isBluetooth-based
no such thing as
client authorization.
Why? Well,
sinceand
authorization is not a requirement for
more.
encryption, it doesn't make sense for a client to request a server to authorize it, if the server does not require
it.
Table of Contents
A good use of the authorization security measure occurs when you're dealing with personal devices. For instance, if
you have a Bluetooth-enabled TV and a Bluetooth-enabled remote control, then you want your TV to only obey
Introduction
commands coming from your remote, obviously. Otherwise, you'll be vulnerable to common pranksters coming within
Chapter 1 - Introducing Bluetooth
range of your house, and changing your channels while you're watching TV—or even worse, turning on your TV at a
Chapter
2 - Bluetooth
1.1
high volume
at 3:00 a.m.!
Bluetooth for Java
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Encryption
- Bluetooth with J2ME MIDP
Chapter 5
Chapter
6 - Creating
a Bluetooth Print
Serverif with
JPS API
Authentication
and authorization
are good
you want
to prevent unwanted users from accessing the services of your
Chapter
7
Java
and
OBEX
Bluetooth devices. However, neither of those security measures will protect your sensitive data from a hacker who has
Chapter
8 tools
- Using
a Bluetooth
Simulator
the right
to "sniff"
your data
while it's being transmitted. Encryption, however, is the security measure that you can
Chapter
Bluetooth
Security
employ9in -order
to protect
your sensitive data transmissions.
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Now, in11
order
to encrypt
information
(whether
you're
using Bluetooth
Chapter
- Enterprise
Bluetooth
Applications
with
the Ericsson
BlipNet or not), you need an encryption algorithm, an
encryption
and the
information
that you want to protect. An encryption algorithm (also called a cipher) is simply a
Chapter
12 -key,
Bluetooth
and
Jini
procedure that is followed in order to scramble the data. Some well-know encryption algorithms are Blowfish, Twofish,
RC4, DES, TripleDES, IDEA, CAST, and Rijndael. The encryption key is simply a code that is used by the algorithm to
Appendix B - javax.obex
encrypt the data. In symmetrical encryption, the same key is used to encrypt and decrypt the data. In asymmetrical
Appendix C - Java Bluetooth Development on the PalmOS Platform
encryption, however, two keys are used to encrypt and decrypt the data.
Appendix A - javax.bluetooth
Appendix D - BlipNet 1.1 API
IndexNote We won't talk about asymmetrical encryption any further because Bluetooth uses symmetrical encryption to
List of Figures
encrypt its data transmissions.
List of Tables
Now
look at a quick example. Listing 9-1 shows some information that needs to be cryptographically protected if
List
of let's
Listings
transmitted from a Bluetooth-enabled cash card.
List of Sidebars
Listing 9-1: Bank Account Information
Bank Name: SDH Bank
Account Name: Bruce Hopkins
Account Number: 123456789
Account Balance: $0.03
Note Of course, we're protecting the bank account number, not the balance!
When the encryption key, as shown in Listing 9-2, and the CAST algorithm are applied to the data, then sensitive bank
account information will get encrypted, as shown in Listing 9-3.
Listing 9-2: A 1024-Bit Encryption Key
mQGiBD1ZRx4RBADgiQLiScTmdxd5aMvRIZbcmSsAzwXWtEBwarMO6xR4SDgp/ji0
KaU02yOD08XxMA2k9yvaQXGpKK6JrTeaqMF9vKyy26Sur3eMtjNxbPJok2XWgcZj
hFCYZjG1/wRbx60sf/xtWSeuhHyKENGhp352/rByvTF0KSEMf2txYZLOOQCg/0al
rqcZTOQyhOWufgMlEIQ2ldED/A3i5oK+ibyN2t10aJpyxFe/NFL5uwbIjyWAndFN
Bluetooth for Java
2rdhOih7fOhNgVVVm6MGuNu/lqD5M576JSEngyQcxaG4G7jCOPElVk79+EJa6eku
ISBN:1590590783
by Bruce Hopkins and Ranjith Antony
ebAaPeq5osCHUAsbUD31vuxSK8qGsMy1xtOgid2gCuS52HDaUAnvIt9ojpMnOPrZ
Apress
©
2003
(352
pages)
zrgzBACZAnCz0Z+RNkYP50ch/UWFqbo6oPR0Z4Vbi1UFvoZl/B8auxSvYueXjAuC
The authors of this text describe how to develop wireless Java
bo8YEEjBlpygWCtw8hP0jxFG3L/hWe95Qkgu8kNTX+SX6bthPBWnvZ7vTgstYyAQ
applications using Bluetooth for a variety of platforms. This
yXLwfLJRYuuT9i8OuqODw3Kc0u3xTwIE4KIIvlHwadYv5z2G+7QhRWR3aW4gSG9w
includes an API overview of the Java library, development of
a2lucyA8YmhvcGtpbnNAZ2x0Zy5jb20+iQBYBBARAgAYBQI9WUceCAsCAwkIBwEK
Bluetooth-based services, highlights of security concerns, and
AhkBBRsDAAAAAAoJEJI0N/w1q4wQWDAAnAmrZRbJXWARLbowLBwfTrJmMfhwAJ9V
more.
l477oH3TB/W2SLbJoSLY9q1CW7kCDQQ9WUceEAgA9kJXtwh/CBdyorrWqULzBej5
UxE5T7bxbrlLOCDaAadWoxTpj0BV89AHxstDqZSt90xkhkn4DIO9ZekX1KHTUPj1
Table
of Contents
WV/cdlJPPT2N286Z4VeSWc39uK50T8X8dryDxUcwYc58yWb/Ffm7/ZFexwGq01ue
Bluetooth
for Java
jaClcjrUGvC/RgBYK+X0iP1YTknbzSC0neSRBzZrM2w4DUUdD3yIsxx8Wy2O9vPJ
Introduction
I8BD8KVbGI2Ou1WMuF040zT9fBdXQ6MdGGzeMyEstSr/POGxKUAYEY18hKcKctaG
Chapter
1 - Introducing Bluetooth
xAMZyAcpesqVDNmWn6vQClCbAkbTCD1mpF1Bn5x8vYlLIhkmuquiXsNV6TILOwAC
Chapter
Agf+M1E08J4AnzN20aLhjbO81jrJn5BIVPkHxm6smP5rIHJ4kpmkoLJstXV+P7HD
2 - Bluetooth 1.1
rWaQXBqBzx0wEchZL+S7qazRQA6dQ8e2fSeMOABQgo7pDjDEn1rKitTh5501qFK6
Chapter
3 - Before You Get Started
yH+tpEC/C9zkpeLNEODK/v1wKj7Xl+d8gEUYxoDALbQ5rZ5e3eTEu+3WFmAIp6AQ
Chapter
4 - Understanding the Java Bluetooth API
Z14BKmP4RYw8ij2lLEHPJ+F6aAZAmzp7U/2HEvQH/7ZrZogz0dmOrAIMpRHgPVsI
Chapter
5 - Bluetooth with J2ME MIDP
uOryEYXSdsG6I3s5xgqY4JR0N96hg38GZjV4/22kt5uncXWbupmOXtyyxBW5roxb
Chapter
6 - Creating a Bluetooth Print Server with JPS API
W/AS2KMkb6Y5s0sSsfQ63inD8IkATAQYEQIADAUCPVlHHgUbDAAAAAAKCRCSNDf8
Chapter
7 - Java and OBEX
NauMECO3AKD1UonZcLkmDx0CGCbJwmp2m0P2jwCg03KNtDRx6FyyZpZc5QRAWbgP
Chapter 8 - Using a Bluetooth Simulator
P4M=
Chapter 9 - Bluetooth Security
=trVX
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix
A - javax.bluetooth
Listing 9-3:
Bank Account Information Encrypted with the CAST Algorithm
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
qANQR1DBwU4DMCkFM4tTfBsQCAC4WJhOUK50sv3gZJ3ivf5BUb+jm9R6n2vKUijp
KUzu3B1PSS3ignZ9t1Bvp+HSXuX3lBq8KsoMYYSwj3QLSkKgYJz1PkAyvyR9bXed
Index
5agRoFvNdQiGDQEP4GtrIjA8/Y6UFvXskQq4w37vwyUoyvS9ONYxGP0eHEA/Yk0b
List of Figures
CjA3i6aFIH81Pksb8pNqr+v0mq5XPFSaYbvLveErCQh6wd63cGzKL8Q23St6JkXi
List
of Tables
rBqfFYa7Eu+Vjc78mTe9vVlWIdw6zyhb35bnaybrLEPW7/xp2K6eIsoiiHngL5MK
List
of
Listings
M4fqruoPp2k7UOnzw0tf1EojEZ8nyOvJCP0ZARHhzNAonA6zB/0f2ygNnNtsEaId
List
of
Sidebars
1OCiIGKohIMmOa07VTXx7cmXUCToSuorIgF43KNs3wP9nPPvxlV3+MhuG4DHF6Tm
oVcR5jdfbFRbbUjzLHVPntP+QS0nE2LAxLsbfMQ6zEkz2F2iJlGbOFy8cjc+eOXJ
jnfG1+z4Ti0MtyvA1T6fd9qJP7TYsBmrQyLLF60PCMVQsnE26+mLH9gn4sgPdPhv
y8ZHjtSfyon5+vgY6tgrY+OSB6GypgN8b2v/RCi9y5WnsNA010W6Xm/iKowTEQAB
j7YxBkoPqC2eOfKwZnAgMcImunFX1767ewIQkcBTiWvOsQ2jQZImD9Fu1xpywdfk
5GLoVny3yXRXHLrAbxysNU+0ylOdRNiPEjvnLG2NpXiCtcWAvuGGw4SID9FIkRiM
Dw/D//p4OgrachGmhZ2rwn9HPIkHjvxbTwtm1qRxlt99yBtP6mfDEWkI8QibLVYr
2RUElEF+3Ak/hVd2er82XjeNbqerhbfCS0Ld9w==
=rZCL
Appendix D - BlipNet 1.1 API
As we stated earlier, Bluetooth uses symmetrical encryption, so there's only one key for encrypting and decrypting
information. However, the key is never transmitted from the server to the client. The encryption key is derived from
several factors that are known to both the client and server (including the PIN). Now let's take a look at how to encrypt
your data transmissions using the JSR-82.
Server Encryption
Bluetooth servers can specify that they want their transmissions encrypted by setting the encrypt parameter to true
in the connection URL, as follows:
String url = "btspp://02AB45AC35DF:00112233445566778899AABBCCDDEEFF;encrypt=true"
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
Encryption requires
the
following
of code wireless
is more Java
descriptive of what's actually going on:
Theauthentication,
authors of this so
text
describe
howline
to develop
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
String url = Bluetooth-based services, highlights of security concerns, and
"btspp://02AB45AC35DF:00112233445566778899AABBCCDDEEFF;
more.
authenticate=true;encrypt=true"
Table of Contents
Bluetooth
However,forif you
Javaexplicitly set authenticate to false, and encrypt to true, then the system will throw a
BluetoothConnectionException. If encryption was not specified in the connection URL, the server can later
Introduction
encrypt1the- Introducing
transmissionBluetooth
by calling the encrypt() method of the RemoteDevice class as shown here:
Chapter
Chapter 2
- Bluetooth 1.1
Chapter
3 an
- Before
You Get of
Started
// get
instance
the RemoteDevice if we don't already have it
Chapter
// assume
4 - Understanding
that we have
the Java
an Bluetooth
active API
Connection object named "conn"
RemoteDevice
remoteDevice
Chapter
5 - Bluetooth
with J2ME MIDP= RemoteDevice.getRemoteDevice(conn);
remoteDevice.encrypt(conn,
true);
Chapter
6 - Creating a Bluetooth Print Server
with JPS API
// now
sensitive information has been
Chapter
7 that
- Java the
and OBEX
// transmitted,
turn off
encryption and send the
Chapter
8 - Using a Bluetooth
Simulator
// rest
the data
unencrypted for better performance
Chapter
9 -of
Bluetooth
Security
remoteDevice.encrypt(conn, false);
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Client Encryption
Appendix A - javax.bluetooth
Appendix
B clients
- javax.obex
Bluetooth
can also require that their communication with their servers be encrypted by setting the encrypt
Appendix
C -to
Java
Bluetooth
Development
on the PalmOS
parameter
true
in the URL
as demonstrated
here: Platform
Appendix D - BlipNet 1.1 API
Index
String url = "btspp://02AB45AC35DF:00112233445566778899AABBCCDDEEFF;encrypt=true"
List of Figures
List of Tables
The
List
of following
Listings line of code is also harmless:
List of Sidebars
String url =
"btspp://02AB45AC35DF:00112233445566778899AABBCCDDEEFF;
authenticate=true;encrypt=true"
If the encrypt parameter is set to false (or is not in the URL at all) then the transmissions between the client and
server are not encrypted.
After the connection has been established, both the server and the client can check to see if the transmission is
encrypted by calling the isEncrypted() method of the RemoteDevice class.
If all of this sounds really complex to you, don't worry; the encryption/ decryption process is all done behind the scenes
by your underlying JSR-82 implementation, so you don't have to worry about ciphers, keys, and other cryptographic
elements.
Bluetooth for Java
Security Example
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
Now let's take a look
at ©
a 2003
practical
demonstration of the security measures that are provided to us by Bluetooth
Apress
(352 pages)
and the JSR-82. The
In this
example,
the
client
uses how
authentication
authorization
over an L2CAP connection to
authors of this text
describe
to develop and
wireless
Java
send a simple message
to
the
server.
Initially,
encryption
is
not
enabled
so
that
we
can demonstrate how easily
applications using Bluetooth for a variety of platforms. This
includes your
an API
overview
of transmissions
the Java library,
of When running the example, we
a third party can capture
wireless
data
if development
left unprotected.
highlights
of security
concerns,
andThe BPA-D10 is a noninstructive
used some of theBluetooth-based
many features services,
of Mobiwave
BPA-D10
Protocol
Analyzer.
more.
Bluetooth Protocol Analyzer that allows the realtime capturing, logging, decoding, and displaying of the
Bluetooth data transmissions. The BPA-D10 is capable of capturing protocol information over the air and
relaying
the data to a host desktop computer through an Ethernet connection. This allows remote data logging
Table
of Contents
and
unlimited
storage capability. Figure 9-1 shows a picture of the device.
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter
11 - 9-1:
Enterprise
Bluetooth BPA-D10
Applications
with the Protocol
Ericsson BlipNet
Figure
The Mobiwave
Bluetooth
Analyzer
Chapter 12 - Bluetooth and Jini
Listing 9-4
the server code for our security example.
Appendix
A -presents
javax.bluetooth
Appendix B - javax.obex
Listing 9-4: ServerApp.java
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
import java.io.*;
Index
import
javax.bluetooth.*;
List
of Figures
import
com.atinav.standardedition.io.*;
List
of Tables
public
class ServerApp {
List
of Listings
List of Sidebars
public static void main(String args[]){
ServerApp a = new ServerApp();
L2CAPConnection con = null;
L2CAPConnectionNotifier service = null;
InputStream in = null;
OutputStream out = null;
String serviceURL = "btl2cap://localhost:1111;name=ATINAV;" +
"authorize=true;authenticate=true;encrypt=false";
LocalDevice local = null;
try {
local = LocalDevice.getLocalDevice();
System.out.println("\n Atinav aveLink Bluetooth Server Application \n");
System.out.println("__________________________________________\n");
System.out.println("My BDAddress: "+ local.getBluetoothAddress());
System.out.println("__________________________________________\n");
service = (L2CAPConnectionNotifier)Connector.open(serviceURL);
//
// Add the service record to the SDDB and
// accept a client Connection
//
Bluetooth for Java
ISBN:1590590783
Hopkins and Ranjith Antony
con by
= Bruce
service.acceptAndOpen();
Apress
©
2003
(352
pages)
System.out.println("\nConnection established to the remote device\n");
The authors of this text describe how to develop wireless Java
applications
Bluetooth
for a variety of platforms. This
byte[]
data using
= new
byte[1000];
includes an API overview of the Java library, development of
while
(!con.ready()){
Bluetooth-based
services, highlights of security concerns, and
try{
more.
Thread.sleep(1);
}catch(InterruptedException ie){}
Table of Contents
}
Bluetooth for Java
con.receive(data);
Introduction System.out.println("Data received at the Server Side "+
Chapter 1 - Introducing Bluetooth
new String(data));
Chapter 2
- Bluetooth 1.1
Chapter 3
String
- Before
YoustrData=
Get Started "This is the Data From the Server Application to "+
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
" the Client Application";
- Bluetooth with J2ME MIDP
Chapter 6
byte[]datax
= strData.getBytes();
- Creating
a Bluetooth
Print Server with JPS API
Chapter 7
con.send(datax);
- Java
and OBEX
//System.out.println("Data sent from the server side." + strData);
try{
Chapter 9 - Bluetooth Security
Thread.sleep(10);
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
}catch(Exception e){}
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
}catch(Exception e){
Chapter 12 - Bluetooth and Jini
e.printStackTrace();
Appendix A
} - javax.bluetooth
Chapter 8
- Using a Bluetooth Simulator
Appendix B - javax.obex
Appendix
} C - Java Bluetooth Development on the PalmOS Platform
Appendix
D - BlipNet 1.1 API
}
Index
List of Figures
List of Tables
Listing
9-5 shows the client code for our security demonstration.
List
of Listings
List of Sidebars
Listing 9-5: ClientApp.java
import java.io.*;
import javax.bluetooth.*;
import com.atinav.standardedition.io.*;
public class ClientApp implements DiscoveryListener{
private static LocalDevice localDevice = null;
private DiscoveryAgent discoveryAgent = null;
private String connectionURL = null;
private RemoteDevice[] device = null;
private ServiceRecord[] records = null;
private boolean inquiryCompl = false;
int count = 0;
int maxSearches = 10;
public ClientApp(){
System.out.println("\n Atinav aveLink Bluetooth Client Application \n");
Bluetooth for Java
System.out.println("________________________________________\n");
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
try{
The authors of
text describe how to develop wireless Java
localDevice
= this
LocalDevice.getLocalDevice();
applications
using
Bluetooth
for a variety of platforms. This
discoveryAgent = localDevice.getDiscoveryAgent();
includes an API overview of the Java library, development of
device
= new RemoteDevice[10];
Bluetooth-based
services, highlights of security concerns, and
System.out.println("_______________________________________\n");
more.
System.out.println("My BDAddress: "+
localDevice.getBluetoothAddress());
Table of Contents
System.out.println("____________________________________\n");
Bluetooth
Java
// for
Starts
inquiry for devices in the proximity and waits till the
Introduction
// inquiry is completed.
Chapter 1
- Introducing Bluetooth
ChapterSystem.out.println("\nSearching
2 - Bluetooth 1.1
for Devices...\n");
ChapterdiscoveryAgent.startInquiry(DiscoveryAgent.GIAC,this);
3 - Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chaptersynchronized(this){
5 - Bluetooth with J2ME MIDP
Chapter 6 this.wait();
- Creating a Bluetooth Print Server with JPS API
Chapter}7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
// Once the Device inquiry is completed it starts searching for the
- Bluetooth Security
// required service. Service search is done with the given uuid. After
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
// starting each search it waits for the result.
Chapter 9
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
// If the connection URL is null, i.e., if No service Records obtained,
Appendix
- javax.bluetooth
//A then
it continues search in the next device detected.
Appendix B - javax.obex
Appendix
C - Java
Bluetooth=Development
on the PalmOS Platform
int[]
attrSet
{0,3,4,0x100};
Appendix
D - BlipNet
1.1 API
UUID[]
uuids
= new UUID[1];
Index uuids[0] = new UUID("1111",true);
List of Figures
System.out.println("\nSearching for Service...\n");
List of Tables
for(int i = 0; i< count; i++){
List of Listings
List of Sidebars
int transactionid =
discoveryAgent.searchServices(attrSet,uuids,device[i],this);
if(transactionid != -1){
synchronized(this){
this.wait();
}
}
if(connectionURL != null)
break;
}
}catch(Exception ie){
ie.printStackTrace();
}
// If the URL of the device begins with btl2cap, then we call the
// getConnection method which establishes a connection with the L2CAPServer
// and returns it.
// Connection returned is of type L2CAPConnection. A piece of raw data is
// being sent over L2CAP.
Bluetooth for Java
if(connectionURL
==Hopkins
null)and Ranjith Antony
ISBN:1590590783
by Bruce
System.out.println("No
service available.......... .");
Apress © 2003 (352 pages)
The authors of this text describe how to develop wireless Java
else if(connectionURL.startsWith("btl2cap")){
applications using Bluetooth for a variety of platforms. This
try{
includes an API overview of the Java library, development of
Bluetooth-based
services, highlights
of security concerns, and
L2CAPConnection
connection
= getconnection();
more.
System.out.println("\nConnection established to the remote device\n");
String strData = "This is the Data From Client Application "+
Table of Contents
"to Server Application";
Bluetooth for Java
byte[] data = strData.getBytes();
Introduction
connection.send(data);
Chapter 1 - Introducing Bluetooth
try{
Chapter 2 - Bluetooth 1.1
Thread.sleep(10);
Chapter 3 - Before You Get Started
}catch(Exception e){}
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5 while(true){
- Bluetooth with J2ME MIDP
Chapter 6 - Creating
Bluetooth=Print
with JPS API
byte[]a datax
newServer
byte[1000];
Chapter 7
- Java and OBEX
Chapter 8
- Using
a Bluetooth
Simulator
while
(!connection.ready()){
Chapter 9
- Bluetooth
try{Security
Thread.sleep(1);
Chapter 10 - Wireless Embedded
Systems with the Micro BlueTarget
}catch(InterruptedException
ie){}
Chapter 11 - Enterprise
Bluetooth Applications with the Ericsson
BlipNet
}
Chapter 12 - Bluetooth
and Jini
connection.receive(datax);
Appendix A - javax.bluetooth
System.out.println("Data received at the Client Side "+
Appendix B - javax.obex
new String(datax));
Appendix C - Java Bluetooth Development on the PalmOS Platform
}
Appendix D - BlipNet 1.1 API
//
connection.close();
Index
List of Figures
}catch(Exception ioe){
ioe.printStackTrace();
List of}Listings
List of}//
Sidebars
end of else if
List of Tables
}
//
// When a device is discovered it is added to the remote device table.
//
public synchronized void deviceDiscovered(RemoteDevice btDevice,
DeviceClass cod){
device[count++] = btDevice;
System.out.println("New Device discovered : "+
btDevice.getBluetoothAddress());
}
//
// When a service is discovered in a particular device and the connection URL
// is not null then the thread that is waiting in the main is notified.
//
public synchronized void servicesDiscovered(int transID,
ServiceRecord[] servRecords){
records = new ServiceRecord[servRecords.length];
for Java
records = Bluetooth
servRecords;
ISBN:1590590783
by
Bruce
Hopkins
and Ranjith Antony
for(int i=0;i<servRecords.length;i++){
Apress © 2003 (352 pages)
The authors
this text describe how to develop wireless Java
int[] atrids
= of
servRecords[i].getAttributeIDs();
applications
using
String servName = Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
(String)((DataElement)servRecords[i].getAttributeValue(0x100)).getValue();
Bluetooth-based services, highlights of security concerns, and
System.out.println("Service
Name : "+ servName);
more.
connectionURL = servRecords[i].getConnectionURL(1,true);
System.out.println("Connection url :" + connectionURL);
Table of Contents
if(connectionURL != null){
Bluetooth for Java
synchronized(this){
Introduction
this.notify();
Chapter 1 - Introducing
Bluetooth
}
Chapter 2 break;
- Bluetooth 1.1
Chapter 3 } - Before You Get Started
} 4 - Understanding the Java Bluetooth API
Chapter
}
Chapter
5 - Bluetooth with J2ME MIDP
//
Chapter
6 - Creating a Bluetooth Print Server with JPS API
// This
notifies the Thread waiting in main if a service
Chapter
7 -function
Java and OBEX
//
search
is
terminated,ie,ig
the responsecode
Chapter 8 - Using a Bluetooth Simulator
// is SERVICE_SEARCH_COMPLETED or SERVICE_SEARCH_NO_RECORDS
Chapter 9 - Bluetooth Security
//
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
public synchronized void serviceSearchCompleted(int transID, int respCode){
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
if(respCode==SERVICE_SEARCH_ERROR)
Appendix A System.out.println("\nSERVICE_SEARCH_ERROR\n");
- javax.bluetooth
Appendix B - javax.obex
Appendix
C - Java Bluetooth Development on the PalmOS Platform
if(respCode==SERVICE_SEARCH_COMPLETED)
Appendix D System.out.println("\nSERVICE_SEARCH_COMPLETED\n");
- BlipNet 1.1 API
Index
List ofif(respCode==SERVICE_SEARCH_TERMINATED)
Figures
System.out.println("\n SERVICE_SEARCH_TERMINATED\n");
List of Tables
List of Listings
== SERVICE_SEARCH_NO_RECORDS){
List ofif(respCode
Sidebars
synchronized(this){
this.notify();
}
System.out.println("\n SERVICE_SEARCH_NO_RECORDS\n");
}
if(respCode == SERVICE_SEARCH_DEVICE_NOT_REACHABLE)
System.out.println("\n SERVICE_SEARCH_DEVICE_NOT_REACHABLE\n");
}
//
// Once the device inquiry is completed it notifies the Thread
// that waits in the Main.
//
public synchronized void inquiryCompleted(int discType){
this.notify();
}
//
// Opens the connection to the Server.
//
Bluetooth
for Java
L2CAPConnection
getconnection()
throws IOException{
ISBN:1590590783
by
Bruce
Hopkins
and Ranjith Antony
return (L2CAPConnection)Connector.open(connectionURL);
Apress
©
2003
(352
pages)
}
The authors
this text describe how
to develop wireless Java
public static
voidofmain(String[]
args){
applications
using
Bluetooth
for
a
variety
ClientApp client = new ClientApp();of platforms. This
includes an API overview of the Java library, development of
}
Bluetooth-based services, highlights of security concerns, and
}
more.
Table of Contents
Bluetooth for Java
Running the Security Example
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Now let's see what happens when we run the example. Figure 9-2 shows our security server waiting for a client
Chapter 2 - Bluetooth 1.1
to connect.
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Figure
security
server is waiting
the client
to connect.
Appendix
C - 9-2:
Java The
Bluetooth
Development
on the for
PalmOS
Platform
Appendix D - BlipNet 1.1 API
Figure 9-3 shows the security client attempting to connect to the server.
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Figure 9-3: The security client is attempting to connect to the server.
The security server requires all clients to authenticate, so the Atinav stack prompts the user to enter a PIN code
as shown in Figure 9-4.
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter
4 - 9-4:
Understanding
the server
Java Bluetooth
Figure
The security
promptsAPI
the user to enter a PIN for the application.
Chapter 5 - Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Note This of course, is a part of Atinav's implementation of the BCC for their stack. Other JSR-82
- Java and OBEX
implementations may allow you to enter the PIN for your server prior to runtime.
Chapter 7
Chapter 8
- Using a Bluetooth Simulator
Chapter
9 the
- Bluetooth
Similarly,
client is Security
also prompted to enter a PIN. Of course, if the client enters an incorrect PIN, then the
Chapter
authentication
10 - Wireless
process
Embedded
will fail. Systems
Figure 9-5
with
shows
the Micro
that the
BlueTarget
authentication process is a success.
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Figure 9-5: The authentication process has succeeded.
In this example, the encrypt parameter in the connection URL was initially set to false in order to show you
how easy it is to capture unencrypted data while in transit. Figure 9-6 shows the Mobiwave BPA-D10 sniffing the
data transmission.
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Figure 9-6: You need to be very careful if you're sending sensitive data unencrypted between Bluetooth
- Understanding the Java Bluetooth API
devices because it can be captured by a third party using a Bluetooth Protocol Analyzer.
Chapter 4
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Now let's
what
Chapter
7 see
- Java
andhappens
OBEX when we set the encrypt parameter to true in the connection URL. The results
are shown
Figure
9-7.
Chapter
8 -in
Using
a Bluetooth
Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Figure 9-7: With encryption enabled, the Protocol Analyzer is still able to capture the data transmission;
however, the data is corrupted.
More on Mobiwave BPA-D10
Given sufficient information, the Mobiwave Protocol Analyzer could decrypt those encrypted packets over
the air. The Mobiwave Protocol Analyzer is equipped with a feature called SmartDecrypt. SmartDecrypt was
designed to tackle the noisy RF environment so that all the seven client/slave sessions could be decrypted
in real time. Here's what you need to do in order to enable SmartDecrypt on the Mobiwave BPA-D10.
The first thing that you need to do is to add the slave devices to the list of known slave devices. From the
BPA-D10 main menu, select Decryption and then select Decryption Setup. This brings up the slave list
dialog box, shown here:
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
Table of Contents
Bluetooth for Java
Introduction
Chapter
1 Add
- Introducing
Bluetooth
Click
to bring up
the Add New Slave dialog box as shown here:
Chapter 2 - Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix
- Java
Bluetooth
Development
the PalmOS
Platform
If theC PIN
is not
available
or defined,onenter
HEX "00"(this
is the default PIN). If the current link key is known,
Appendix
D
BlipNet
1.1
API
you can enter it, else leave this field blank. Click OK when you are done. The current link key, if not
Indexspecified, will be automatically generated during the capture of a good pairing or bonding session between
List ofthe
Figures
two Bluetooth devices.
List of Tables
let's run the security sample application again with the encrypt parameter set to true. Remember to
List ofNow
Listings
the same PIN code you used to configure your slave device in the BPA-D10. The following figure
List ofset
Sidebars
illustrates how the Mobiwave Protocol Analyzer intelligently decrypted data packets on the fly:
Please note that the SmartDecrypt feature of the BPA-D10 does not illustrate any of the limitations or
shortcomings of Bluetooth's wireless encryption capabilities.
Prior to decrypting the Bluetooth-encrypted packets successfully, the following information must be
available:
The slave or client BD address that is involved
Bluetooth for Java
ISBN:1590590783
Bruce
Hopkins
and
The PIN by
that
is used
during
theRanjith
pairingAntony
or bonding session
Apress © 2003 (352 pages)
When the
pairing
or bonding
session
is carried
out
The
authors
of this text
describe
how to develop
wireless Java
applications using Bluetooth for a variety of platforms. This
Confirmation
includes
of aan
good
API capture
overviewof
ofthe
thepairing
Java library,
or bonding
development
sessionof
Bluetooth-based services, highlights of security concerns, and
more.
If any of this information
is missing or incomplete, the decryption will not be successful. Information such as
when a pairing or bonding session is made is a rare and random event. Furthermore, during the capturing
of a pairing or bonding session, many things could go wrong due to interference over the air or Bluetooth
Table of Contents
devices being out of range. Bluetooth's encryption mechanism is not easily breached or compromised.
Bluetooth for Java
Introduction
Java developers can further mitigate this risk by creating their own symmetric or asymmetric encryption
Chapter
1 - Introducing
Bluetooth
routines
by using the
libraries from the JCE (Java Cryptography Extension) or from the Bouncy Castle at
http://www.bouncycastle.org.
Chapter
2 - Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Summary
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
This chapter introduced
thepages)
security measures that you can employ to make your Bluetooth
Apress ©you
2003to(352
applications with The
the JSR-82
more
You learned
about how
to use
the APIs in the JSR-82 in order
authors of this secure.
text describe
how to develop
wireless
Java
to enable authentication,
authorization,
and
encryption
in
your
Bluetooth
applications.
This chapter also
applications using Bluetooth for a variety of platforms. This
includes to
anthe
APIMobiwave
overview of
the Java Protocol
library, development
gave you an introduction
BPA-D10
Analyzer. of
Bluetooth-based services, highlights of security concerns, and
more.the JSR-82 in order to make client-server, peer-to-peer, and cable replacement
So far, we have used
wireless applications. In the next chapter, we'll take a look at the SND Micro BlueTarget in order to make
fixed-wireless applications using the JSR-82.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
for Java
Chapter Bluetooth
10: Wireless
EmbeddedISBN:1590590783
Systems with the
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
Micro BlueTarget
The authors of this text describe how to develop wireless Java
applications
using Bluetooth
for a variety
of platforms.
Thisand rightfully so since the JSR-82
So far, this book has
taken mainly
a software-based
approach
to things,
includes an API overview of the Java library, development of
is a software specification
about
controlling
Bluetooth
devices
with
the
Java language. In the past,
Bluetooth-based services, highlights of security concerns, and
Bluetooth device more.
manufacturers envisioned their devices to be programmed in a native language like
assembly or C, and making a Java interface to their devices was pretty much an afterthought. In this
chapter, we're going to take a look at a device that was developed with the JSR-82 in mind: the Micro
Table
of Contents
BlueTarget
from Smart Network Devices (http://www.smartnd.com).
Bluetooth for Java
Introduction
What Is the Micro BlueTarget?
Chapter 1
- Introducing Bluetooth
Chapter
2 is-the
Bluetooth
1.1
So what
Micro BlueTarget
and what can it do? The Micro BlueTarget is a fully self-contained
Chapter
3 that
- Before
You Get
Started radio, a Bluetooth stack, Bluetooth profiles, an operating system, a
computer
includes
a Bluetooth
Chapter
J2ME VM,
4 -and
Understanding
the JSR-82the
libraries.
Java Bluetooth
Figure 10-1
API shows the Micro BlueTarget standard version, and Figure
10-2 shows
the Microwith
BlueTarget
Starter Kit.
Chapter
5 - Bluetooth
J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List ofFigure
Sidebars
10-1: The Micro BlueTarget standard version is a small form factor embedded system with a
board outline of just 3.25.9 cm! This is a great solution for OEMs that want to make their devices
Bluetooth enabled.
Figure 10-2: The Micro BlueTarget Starter Kit uses a standard Micro BlueTarget and adds RS-232
and Ethernet ports, which is ideal for developers who need to create quick prototypes and proofs of
concepts.
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
The Micro BlueTarget
been
to meet typical requirements of fixed-wireless infrastructure
Apresshas
© 2003
(352designed
pages)
components. What's
a
fixed-wireless
device?
A fixed-wireless
is Java
typically a large, stationary device
The authors of this text describe
how to developsystem
wireless
that is capable ofapplications
wireless communication.
Consumer-oriented
fixed-wireless
systems are things like
using Bluetooth for a variety of platforms. This
includes
an API overview
the vending
Java library,
development
of
network access points,
information
kiosks,ofand
machines
(see Figure
10-3). On the other hand, a
Bluetooth-based
of security
typical example of
a fixed-wirelessservices,
system highlights
for commercial
use concerns,
would be and
a large machine in a
more.
manufacturing center (see Figure 10-4).
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Figure
A Bluetooth
Chapter
9 - 10-3:
Bluetooth
Security phone utilizing the services of a fixed-wireless consumer system— a
Bluetooth-enabled
vendingSystems
machinewith the Micro BlueTarget
Chapter
10 - Wireless Embedded
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
10-4: A Bluetooth PDA receiving the status from a fixed-wireless commercial system— a
List ofFigure
Sidebars
Bluetooth-enabled machine in a manufacturing facility
In the rest of this chapter, we'll take a look at the physical aspects of Micro BlueTarget, starting off with its
hardware configuration. Next, we'll add a brief discussion about its software configuration by looking at the
operating system and its Java implementation. Finally, we'll round up the chapter with some information
on how to start the development process with this device by providing some example code.
Bluetooth for Java
The Micro BlueTarget
Hardware Configuration
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
Figure 10-5 is a block
diagram
that
describes the interrelationship of the hardware components that
Apress
© 2003 (352
pages)
comprise the Micro
BlueTarget.
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Figure 10-5: A block diagram of the Micro BlueTarget hardware components
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
The Micro BlueTarget is based upon the 32-bit RISC/DSP embedded micro-processor architecture from
Hyperstone
List
of FiguresAG (http://www.hyperstone.com). Smart Network Devices chose this architecture
primarily
because of its extremely low gate count (the CPU itself consists of only just 35,000 gates), which
List
of Tables
equates
to its low power consumption. In the future, this opens the door for the possibility of smaller form
List
of Listings
factor
solutions, even System-on-Chip (SoC) architectures.
List
of Sidebars
The Bluetooth baseband controller is a BlueCore 01b from CSR (see Figure 2-2), which is interfaced
through a standard 16550-compatible UART device. By using a dual UART module (the 16752 chip) in the
device, one UART is still free for external serial communication.
Note The Micro BlueTarget Starter Kit connects the available UART to the RS-232 port. This allows
developers who don't have a lot of hardware experience to quickly utilize the Micro BlueTarget
for external serial communication.
Note As an option, the dual UART device can be substituted by one of the many PIC family
microcontrollers. This will enable the Micro BlueTarget to externally communicate via other
protocols such as SPI, I2C, and GPIO. Some PIC chips will even enable the Micro BlueTarget to
have a CAN bus interface or perform A/D conversion.
Here's a quick synopsis of the hardware details of the Micro BlueTarget:
120 MHz, 32-bit RISC/DSP Hyperstone E1-16XS CPU
3.3 VDC (@ 250 mA)
8MB SDRAM memory
2+1MB flash memory
10/100 Mb/s Ethernet interface
Bluetooth for Java
ISBN:1590590783
by Bruce
Hopkinsradio
and Ranjith
Antony radio range)
Integrated Class
2 Bluetooth
(10m nominal
Apress © 2003 (352 pages)
Available serial
portdescribe
(UART with
to 3 Mb/s
transfer
rate)
Thecommunication
authors of this text
how up
to develop
wireless
Java
applications using Bluetooth for a variety of platforms. This
Peripheral I/O
bus connector
(addresses,
RD/WR,
chip selects,
interrupts)
includes
an API overview
of the8-bit
Javadata,
library,
development
of
Bluetooth-based services, highlights of security concerns, and
more.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
The Micro BlueTarget
Software Configuration
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
The Micro BlueTarget
the HyNetOS, SND's specialized operating system for the Hyperstone
Apressboard
© 2003runs
(352 pages)
RISC/DSP CPU architecture.
The
washow
created
for primarily
two
reasons. The first reason was to
The authors of thisHyNetOS
text describe
to develop
wireless
Java
have the smallestapplications
possible memory
footprint
in
order
to
match
internal
memory
sizes of future Systemsusing Bluetooth for a variety of platforms. This
includes an API
overview
the Java library,
development
on-Chip (SoC) architectures.
The
memoryoffootprints
for Embedded
Linuxofand Embedded Windows (also
Bluetooth-based
services,
concerns,
and Secondly, by creating their
known as Windows
CE .NET) were
simplyhighlights
too large of
tosecurity
even think
about SoC.
more.
own OS, Smart Network Devices can have a highly efficient network and data communication architecture,
which is optimized for the underlying platform. All interprocess communication is event driven and takes
place
an internal message system.
Table
ofthrough
Contents
Bluetooth for Java
The HyNetOS is based upon a highly efficient multitasking real-time kernel (only 16kB in size) and is
written entirely in Hyperstone assembler. On top of the kernel is a complete operating environment that
Chapter 1 - Introducing Bluetooth
consists of following components:
Introduction
Chapter 2
- Bluetooth 1.1
Chapter
3 - Before
You Get Started
Device
manager
Chapter 4
- Understanding the Java Bluetooth API
Protocol
managerwith J2ME MIDP
Chapter
5 - Bluetooth
Chapter 6
- Creating a Bluetooth Print Server with JPS API
File manager
Chapter 7
- Java and OBEX
Chapter
Java
8 Virtual
- UsingMachine
a Bluetooth Simulator
Chapter 9
- Bluetooth Security
The device manager is simply a layer that abstracts the underlying hardware, and the protocol manager is
a layer that implements the TCP/IP and Bluetooth protocol stacks. The multifaceted file manager can
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
handle different file systems, including RAM disk and flash disk, as well as external memory cards (we'll
Chapter 12 - Bluetooth and Jini
cover the details of the JVM in the next section).Figure 10-6 gives an illustration of the overall structure of
Appendix A - javax.bluetooth
the HyNetOS.
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Figure 10-6: A structural overview of the HyNetOS for the Micro BlueTarget
The Java Implementation
The Java Virtual Machine
forfor
theJava
Micro BlueTarget is an implementation of the Sun Microsystems Java 2
Bluetooth
Micro Edition (J2ME)
KVM/CLDC
V1.0.3 and has passed the CLDC
Technology Compatibility Kit (TCK). In
ISBN:1590590783
by Bruce Hopkins and Ranjith Antony
addition to providing
the
JSR-82
APIs,
Smart
Network
Devices
has
provided
additional libraries for Micro
Apress © 2003 (352 pages)
BlueTarget development, such as
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
UDP (datagram)
socket communication
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
TCP (stream)more.
socket communication
HTTP 1.1 libraries
Table of Contents
RS-232 serial communication (you can address ports COM1-COM5)
Bluetooth for Java
Introduction
Graphics library for monochrome LCD (12864 pixel)
Chapter 1 - Introducing Bluetooth
Java
to 1.1
ITU-style keypad (keys: 0–9,*,#)
Chapter
2 interface
- Bluetooth
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
File I/O library
Chapter
5 - Bluetooth
with J2ME
MIDP
For performance
reasons
and memory
footprint size, the TCP/IP and the Bluetooth stacks were written in
Chapter
6
Creating
a
Bluetooth
Print Server native
with JPS
API
C and were implemented as asynchronous
processes.
The Java VM, which exists as a native
Chapter
7 executable,
- Java and OBEX
HyNetOS
has its own internal thread scheduler. A second process, called the asynchronous
Chapter
event handler,
8 - Using
interfaces
a Bluetooth
the asynchronous
Simulator
protocol software to the synchronous Java VM task. So what
does all9 this
mean? Once
a Java thread makes a blocking I/O call (while waiting to receive data), not only
Chapter
- Bluetooth
Security
will all other
native OS
tasks beSystems
scheduled
the
CPU,
but all other Java threads as well. This approach
Chapter
10 - Wireless
Embedded
withon
the
Micro
BlueTarget
ensures11the
best possible
matchApplications
of synchronous
andEricsson
asynchronous
Chapter
- Enterprise
Bluetooth
with the
BlipNet computing architectures in order to
achieve12the
best optimum
system performance.
Chapter
- Bluetooth
and Jini
Appendix A - javax.bluetooth
The Bluetooth Implementation
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
On the Bluetooth
things, the CSR baseband controller handles all low-level Bluetooth protocols up
Appendix
D - BlipNetside
1.1 of
API
to the HCI interface. The corresponding firmware is located in a separate flash memory (refer back to
Index
Figure 10-5), which can be updated dynamically through the HyNetOS host system. An HCI driver, L2CAP,
RFCOMM, SDP, and some of the basic profiles like General Access Profile, Serial Port Profile, LAN
List of Tables
Access Profile, and Service Discovery Application Profile comprise the Bluetooth portion of the HyNetOS
List of Listings
protocol manager.
List of Figures
List of Sidebars
Now that you have a general overview of the underlying hardware implementation of the Micro BlueTarget,
let's take a look at the OS and included software for this device.
for Java
ApplicationBluetooth
Development
on the Micro BlueTarget Platform
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
The core HyNetOS
system
is contained
Apress
© 2003
(352 pages) in a single file, named PROJECT.HEX. Figure 10-7 is a diagram of the memory
map of the MicroThe
BlueTarget's
flashdescribe
memory
module.
authors of 2MB
this text
how
to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter
10 - 10-7:
Wireless
Embedded
withMicro
the Micro
BlueTarget
Figure
The
memory Systems
map of the
BlueTarget.
End user applications have about 1.5MB of space on the
Chapter
flash
11 disk.
- Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Apart from the bootloader section (also called the ROM section), the remaining flash memory space is organized as a
large solid-state disk. Since HyNetOS comes built-in with an FTP server, this flash disk can easily be administrated
Appendix
C -FTP
Java
Bluetooth
Development on the PalmOS Platform
using any
client
program.
Appendix B - javax.obex
Appendix D - BlipNet 1.1 API
In order to specify device drivers or interfaces that you would like to see started with HyNetOS after a system reset, you
Index
need
to edit a configuration file named JSTARTUP.INI. This file can also be used to designate the class files that you
List
of Figures
want
be executed at boot time. A typical JSTARTUP.INI would look like this:
List
of Tables
List of Listings
[devices]
List
of Sidebars
COM1
COM2
ETHSMSC111
LCD12864
KEYPAD
BLUETOOTH
[protocols]
TCP/IP
BLUETOOTH
[applications]
myapp.class
Operating System Tools
Several tools are provided to the user in order to perform common sysadmin tasks on the Micro BlueTarget. You can
do things like load a new OS, reboot the system, format the flash disk, and trace the application code. All these tools
are Java desk-top applications (J2SE), and can be executed on any Java-enabled platform.
HYFLASH
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
HYFLASH is an administration
toolpages)
for the Micro BlueTarget's flash memory (the flash disk). It can check and update
Apress © 2003 (352
the ROM section,The
format
the
flash
disk,
upload
fromwireless
any directory
authors of this text and
describe
howcontent
to develop
Java on your PC to the target system.
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more. OS loader. If the HyNetOS is already stored on the flash disk, the bootloader will
HYLOAD is the dynamic
HYLOAD
automatically boot the system after a system reset. At runtime, however, an OS restart can always be triggered using
HYLOAD while dynamically uploading a newer version of the OS.
Table of Contents
Bluetooth for Java
HYMON
Introduction
Chapter
1 is-the
Introducing
Bluetooth system monitor console. On the PC, this text-based monitor can be used to check
HYMON
Micro BlueTarget's
Chapter
- Bluetooth
1.1
the file 2system,
display
directories, and set network settings (such as the IP address, netmask, gateway, etc.). The
Chapter
3 utility
- Before
HYMON
can You
alsoGet
be Started
used to start Java applications on the device. At the system prompt, simply type
Chapter 4 - Understanding the Java Bluetooth API
Chapter
5 - Bluetooth with J2ME MIDP
kvm myapp
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
to start 8up -myapp.class
on Simulator
the device.
Chapter
Using a Bluetooth
Chapter 9
- Bluetooth Security
HYTRACE
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
HYTRACE is the Micro BlueTarget's system trace window. Stacktrace messages and output from your
Chapter
12 - Bluetooth and Jinistatements in your Java code will appear here.
System.out.println()
Appendix A - javax.bluetooth
Appendix B - javax.obex
Programming the Micro BlueTarget
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix
BlipNet
1.1 API wireless applications for the Micro BlueTarget, you first need to set up your development
In order Dto-start
developing
Index
environment. Here are the steps that are involved:
List of Figures
1. Connect your Micro BlueTarget board to your PC using a crossover Ethernet cable.
List of Tables
List of
2.Listings
Configure your Micro BlueTarget's IP network parameters using the HYMON utility.
List of Sidebars
3. Format the Micro BlueTarget's flash disk using the HYFLASH utility.
4. Create the necessary configuration files and transfer them to the Micro BlueTarget's flash disk.
These steps are all explained in detail in the Micro BlueTarget Starter Kit documentation. After you compile and
preverify your code, just FTP the corresponding class files for your application to the Micro BlueTarget and hit the reset
button. If your app is specified in the JSTARTUP.INI file, then it will automatically start up; otherwise, just start your
application manually using the HYMON utility.
Note The HyNetOS is a multilanguage, multitasking embedded operating system that can run native C
applications and Java apps at the same time. In order to resolve conflicting requests between native and
Java applications that want to utilize the Bluetooth stack and radio, Smart Network Devices created a
centralized entity called the Bluetooth Service. The Bluetooth Service in JSR-82 vernacular is called the
Bluetooth Control Center (BCC). As mentioned in Chapter 4, the Bluetooth Control Center doesn't
necessarily have to be a Java application, and in the case of the Micro BlueTarget, the Bluetooth Control
Center is a native application. For the Micro BlueTarget, you can initialize and control the Bluetooth Control
Center via configuration files.
The Wireless Network Access Point
Let's say that you have a Bluetooth-enabled device like a PDA or laptop, and want to use it to access the Internet via a
traditional LAN access point (refer to Figure 10-8). With the Micro BlueTarget, you're already halfway there, and no
Java coding is needed!
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Figure 10-8:Bluetooth-based
Using the built-in
functionality
of the
BlueTarget,
services,
highlights
ofMicro
security
concerns, you
and can have any Bluetooth device with the
LAN Access more.
Profile access the Internet (or any other Ethernet-based network).
So, in
to accomplish this with the HyNetOS, all you need to do is to edit the parameters in a configuration named
Table
oforder
Contents
BTAUTOLAN.CFG.
The contents of the file would look something like this:
Bluetooth
for Java
Introduction
[BT LAN
Chapter
1 -ACCESS]
Introducing Bluetooth
MODE=automatic
Chapter
2 - Bluetooth 1.1
IP-ASSIGNMENT=automatic
Chapter
3 - Before You Get Started
INQUIRY-CYCLE=15
; in
Chapter
4 - Understanding the Java Bluetooth
APIseconds
Chapter 5
- Bluetooth with J2ME MIDP
[PPP]
- Creating a Bluetooth Print Server with JPS API
USER-ID=myName
Chapter 7 - Java and OBEX
PASSWORD=myPassword
Chapter 8 - Using a Bluetooth Simulator
AUTHENTICATION=PAP,CHAP
; preferred methods
Chapter 6
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter
11 -BlueTarget
Enterprise Bluetooth
Applications
the Ericsson
BlipNet
The Micro
would then
constantlywith
search
(in this case,
every 15 seconds) for appropriate devices and
Chapter
provide12
them
- Bluetooth
with network
and Jini
access.
Appendix A - javax.bluetooth
Note Now, it's nice to know that the Micro BlueTarget has the built-in capability to function as a wireless network
access point, but what type of effort would be involved if you wanted to develop that functionality yourself?
Appendix C - Java Bluetooth Development on the PalmOS Platform
First of all, since the JSR-82 doesn't provide any foundational classes to write apps according to the LAN
Appendix D - BlipNet 1.1 API
Access Profile, then you'll need to implement it on your own. According to the LAN Access Profile portion of
Index
the Bluetooth specification, data terminals (i.e., phones, PDAs, etc.) are supposed to authenticate with the
List of Figures
LAN access point using the PPP protocol. After that, the data terminal will be assigned a dynamic IP
List of Tables
address, an IP gateway, and a DNS server for Internet name resolution.You're not out of the woods yet, but
List of Listings
that's where a majority of the effort should exist.
Appendix B - javax.obex
List of Sidebars
L2CAPEcho Example
L2CAPEcho is a very simple example that will demonstrate communication between two Micro BlueTarget devices.
This is the first example involving two Micro BlueTarget devices, and this is the kind of example that you want to run
just to make sure you can get two devices talking to each other. If this example doesn't work, then you need to
troubleshoot your setup and configuration.
So how does it work? Well, as shown in Figure 10-9, one board is offering an "echo service" to the public. The other
board is the client that is using that service and is sending messages to the server.
Figure 10-9: The L2CAPEcho Service
Since this example contains most of the foundational elements that were described previously in this book, we won't go
into further explanation other than the fact that the client sends a message once per second to the server. The server
reads the message from the InputStream and writes it back to the OutputStream, and the client gets the message
back as an echo. Listing 10-1 shows the code for the L2CAPEchoServer.
Listing 10-1: L2CAPEchoServer.java
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
import
import
import
import
ISBN:1590590783
java.lang.*;
Apress © 2003 (352 pages)
java.io.*;
The authors of this text describe how to develop wireless Java
javax.microedition.io.*;
applications using Bluetooth for a variety of platforms. This
javax.bluetooth.*;
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
public class more.
L2CAPEchoServer
{
static
ClientProcess Client = null;
Table of
Contents
Bluetooth for Java
public static void main(String[] args)
{
Chapter 1 - Introducing Bluetooth
L2CAPConnectionNotifier Server = null;
Introduction
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
-{Understanding the Java Bluetooth API
Chapter 5
Chapter 6
- Bluetooth
with J2ME MIDP
LocalDevice
local = LocalDevice.getLocalDevice();
- Creating
a
Bluetooth Print Server with DiscoveryAgent.GIAC
JPS API
local.setDiscoverable(
);
Chapter 7
-}Java and OBEX
Chapter 8
-catch
Using a (BluetoothStateException
Bluetooth Simulator
e)
-{Bluetooth Security
Chapter 9
try
System.err.println(
to start service" );
Chapter 10 - Wireless
Embedded Systems with "Failed
the Micro BlueTarget
System.err.println("BluetoothStateException:
" + e.getMessage() );
Chapter 11 - Enterprise
Bluetooth Applications with the Ericsson BlipNet
return;
Chapter 12 - Bluetooth
and Jini
Appendix A -}javax.bluetooth
Appendix B - javax.obex
try
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
{
List of Figures
List of Tables
// start the echo server (with a fictional UUID)
String url = "btl2cap://localhost:00112233445566778899AABBCCDDEEFF";
Server = (L2CAPConnectionNotifier)Connector.open(url);
List of Listings
}
List of Sidebars
catch (IOException e)
{
System.err.println( "Failed to start service" );
System.err.println( "IOException: " + e.getMessage() );
return;
}
System.out.println( "Starting L2CAP Echo Server" );
// This server actually runs forever. However, it can be stopped
// by terminating the KVM from the command line
// The server can terminate client connections by
// setting the client connections public variable "end" to "true"
// like: L2CAPEchoServer.Client.end = true;
while( true )
{
L2CAPConnection conn = null;
try
{
// wait for incoming client connections (blocking method)
conn = Server.acceptAndOpen();
Bluetooth for Java
by Bruce
and Ranjith
// Hopkins
here we've
got Antony
one, start ISBN:1590590783
it in a separate thread
Apress
©
2003
(352
pages)
L2CAPEchoServer.Client = new ClientProcess(conn);
The authors
of this text describe how to develop wireless Java
L2CAPEchoServer.Client.start();
applications
using
Bluetooth for a variety of platforms. This
}
includes an API overview of the Java library, development of
catch
(IOException
e)
Bluetooth-based
services, highlights
of security concerns, and
{more.
System.out.println("IOException: " + e.getMessage());
}
Table of Contents
}
Bluetooth
} for Java
Introduction
}
Chapter 1
- Introducing Bluetooth
Chapter
class2 ClientProcess
- Bluetooth 1.1
extends Thread
{
Chapter
3
- Before You Get Started
L2CAPConnection
clientconn;
Chapterstatic
4 - Understanding
the Java Bluetooth
API
boolean
Chapterpublic
5 - Bluetooth
with J2ME MIDP
Chapter 6
end;
- Creating a Bluetooth Print Server with JPS API
Chapter//
7 the
- Javaconstructor
and OBEX
ClientProcess(
L2CAPConnection conn )
- Using a Bluetooth Simulator
{
Chapter 9 - Bluetooth Security
this.clientconn = conn;
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
this.end = false;
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
}
Chapter 8
Chapter 12 - Bluetooth and Jini
Appendix
- javax.bluetooth
//A start
the communication with the client
Appendix
B
- javax.obex
public
void run()
Appendix
{ C - Java Bluetooth Development on the PalmOS Platform
Appendix D -byte[]
BlipNet 1.1
API = null;
data
Index
int length;
List of Figures
List of TablesSystem.out.println( "Client is connected" );
List of Listings
while( !end )
List of Sidebars
{
try
{
// prepare a receive buffer
length = clientconn.getReceiveMTU();
data = new byte[length];
// read in the data sent by the client (method blocks!)
length = clientconn.receive(data);
System.out.println( "Received " + length + " bytes from client" );
// and immediately send it back on the same connection (echo)
clientconn.send(data);
}
catch( IOException e )
{
System.out.println("IOException: " + e.getMessage());
}
}
try
{
Bluetooth for Java
clientconn.close();
ISBN:1590590783
by Bruce Hopkins and Ranjith Antony
}
Apress
©
2003
(352
pages)
catch( IOException e )
The authors of this text describe how to develop wireless Java
{
applications using Bluetooth for a variety of platforms.
This
System.out.println("IOException:
" + e.getMessage());
includes an API overview of the Java library, development of
}
Bluetooth-based services, highlights of security concerns, and
}
more.
}
Table of Contents
Bluetooth for Java
Introduction
Listing 10-2 shows the code for the L2CAPEchoClient.
Chapter 1 - Introducing Bluetooth
Listing210-2:
L2CAPEchoClient.java
Chapter
- Bluetooth
1.1
Chapter 3
- Before You Get Started
Chapter
import
4 java.lang.*;
- Understanding the Java Bluetooth API
import
Chapter
5 java.io.*;
- Bluetooth with J2ME MIDP
import
Chapter
6 java.util.*;
- Creating a Bluetooth Print Server with JPS API
import
Chapter
7 javax.microedition.io.*;
- Java and OBEX
import
Chapter
8 javax.bluetooth.*;
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
public class L2CAPEchoClient implements DiscoveryListener
{
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
// The DiscoveryAgent for the local Bluetooth device.
Chapter 12 - Bluetooth and Jini
private DiscoveryAgent agent;
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Appendix A - javax.bluetooth
Appendix B - javax.obex
// The max number of service searches that can occur at any one time.
Appendix
C - Java int
Bluetooth
Development on the PalmOS
private
maxServiceSearches
= 0; Platform
Appendix D - BlipNet 1.1 API
Index // The number of service searches that are presently in progress.
List of Figures
private int serviceSearchCount;
List of Tables
List of Listings
// Keeps track of the transaction IDs returned from searchServices.
private int transactionID[];
List of Sidebars
// The service record to an echo server that can reply to the message
// provided at the command line.
private ServiceRecord record;
// Keeps track of the devices found during an inquiry.
private Vector deviceList;
// The constructor: creates an L2CAPEchoClient object and prepares the
object
// for device discovery and service searching.
public L2CAPEchoClient() throws BluetoothStateException
{
// Retrieve the local Bluetooth device object.
LocalDevice local = LocalDevice.getLocalDevice();
// Retrieve the DiscoveryAgent object that allows us to perform device
// and service discovery.
agent = local.getDiscoveryAgent();
// Retrieve the max number of concurrent service searches that can
// exist at any one time.
try
Bluetooth for Java
{
ISBN:1590590783
by Bruce Hopkins and Ranjith
maxServiceSearches
= Antony
Apress
©
2003
(352
pages)
Integer.parseInt( LocalDevice.getProperty("bluetooth.sd.trans.max") );
The authors of this text describe how to develop wireless Java
}
applications
using Bluetooth for a variety
catch(
NumberFormatException
e ) of platforms. This
includes an API overview of the Java library, development of
{
Bluetooth-based services, highlights of security concerns, and
System.out.println(
"General Application Error" );
more.
System.out.println( "NumberFormatException: " + e.getMessage() );
}
Table of Contents
Bluetooth fortransactionID
Java
= new int[maxServiceSearches];
Introduction
Chapter 1
Chapter 2
-//
Introducing
Bluetooth
Initialize
the transaction list
-for(
Bluetooth
int1.1i=0; i<maxServiceSearches; i++ )
Chapter 3
-{Before You Get Started
Chapter 4
transactionID[i]
= -1;
- Understanding
the Java Bluetooth
API
Chapter 5
-}Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
null;
-record
Java and =
OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
}
deviceList = new Vector();
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
// Adds the transaction table with the transaction ID provided.
private void addToTransactionTable( int trans )
Chapter 12 - Bluetooth and Jini
{
Appendix A -for(
javax.bluetooth
int i=0; i<transactionID.length; i++ )
Appendix B -{javax.obex
Appendix C - Java if(
Bluetooth
Development on the ==
PalmOS
Platform
transactionID[i]
-1 )
Appendix D - BlipNet
1.1
API
{
Index
transactionID[i] = trans;
List of Figures
return;
}
List of Tables
}
List of Listings
}
List of Sidebars
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
// Removes the transaction from the transaction ID table.
private void removeFromTransactionTable( int trans )
{
for( int i=0; i<transactionID.length; i++ )
{
if( transactionID[i] == trans )
{
transactionID[i] = -1;
return;
}
}
}
// Completes a service search on each remote device in the list until all
// devices are searched or until an echo server is found that this application
// can send messages to.
private boolean searchServices( RemoteDevice[] devList )
{
UUID[] searchList = new UUID[2];
// Add the UUID for L2CAP to make sure that the service record
Bluetooth
forsupport
Java
// found
will
L2CAP. This value is defined in the
ISBN:1590590783
by
Bruce
Hopkins
and Ranjith
Antony document.
// Bluetooth Assigned
Numbers
Apress
©
2003
(352
pages)
searchList[0] = new UUID(0x0100);
The authors of this text describe how to develop wireless Java
applications
usingfor
Bluetooth
for a variety
of platforms.
This are going to use to
// Add
the UUID
the echo
service
that we
includes an API overview of the Java library, development of
// the
list of UUIDs
tohighlights
searchof for.
(aconcerns,
fictional
echo service UUID)
Bluetooth-based
services,
security
and
searchList[1]
= new UUID( "00112233445566778899AABBCCDDEEFF", false );
more.
// Start a search on as many devices as the system can support.
Table of Contents
for( int i=0; i<devList.length; i++ )
Bluetooth for{Java
Introduction
System.out.println( "Length = " + devList.length );
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth
// If
1.1 we found a service record for the echo service, then
Chapter 3
//You
weGetcan
end the search.
- Before
Started
Chapter 4
if( record
!= Bluetooth
null ) API
- Understanding
the Java
Chapter 5
{
- Bluetooth
with J2ME MIDP
Chapter 6
"Record
is not null" );
- Creating a System.out.println(
Bluetooth Print Server with JPS
API
Chapter 7
return true;
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
}
try
{
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
System.out.println( "Starting Service Search on " +
devList[i].getBluetoothAddress() );
Appendix A - javax.bluetooth
int trans =
Appendix B - javax.obex
agent.searchServices( null, searchList, devList[i], this );
Chapter 12 - Bluetooth and Jini
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1System.out.println(
API
"Starting Service Search " + trans );
Index
addToTransactionTable( trans );
List of Figures
List of Tables
List of Listings
List of Sidebars
}
catch( BluetoothStateException e )
{
// Failed to start the search on this device, try another device.
System.out.println( "BluetoothStateException: " + e.getMessage() );
}
// Determine if another search can be started. If not, wait for
// a service search to end.
synchronized( this )
{
serviceSearchCount++;
System.out.println( "maxServiceSearches = " + maxServiceSearches );
System.out.println( "serviceSearchCount = " + serviceSearchCount );
if( serviceSearchCount == maxServiceSearches )
{
System.out.println( "Waiting" );
try
{
this.wait();
}
catch( Exception e ) {}
}
System.out.println( "Done Waiting " + serviceSearchCount );
}
}
Bluetooth
forall
Javathe service searches have completed.
// Wait
until
ISBN:1590590783
by
Bruce
Hopkins
and Ranjith Antony
while( serviceSearchCount
> 0 )
Apress
©
2003
(352
pages)
{
The authors of this(this)
text describe how to develop wireless Java
synchronized
applications
using
Bluetooth
for a variety of platforms. This
{
includes an API overview of the Java library, development of
try
Bluetooth-based
services, highlights of security concerns, and
more.{
this.wait();
}
Table of Contents
catch (Exception e) {}
Bluetooth for Java }
Introduction }
Chapter 1
- Introducing Bluetooth
Chapter 2
-if(
Bluetooth
record
1.1 != null )
Chapter 3
-{Before You Get Started
Chapter 4
System.out.println(
is not null" );
- Understanding
the Java Bluetooth "Record
API
Chapter 5
return
true;
- Bluetooth
with J2ME
MIDP
Chapter 6
-}Creating a Bluetooth Print Server with JPS API
Chapter 7
-else
Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
{
System.out.println( "Record is null" );
return false;
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
}
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
}
Chapter 12 - Bluetooth and Jini
Appendix
- javax.bluetooth
//A Finds
the first echo server that is available to send messages to.
Appendix
B
- javax.obex
public
ServiceRecord findEchoServer()
Appendix
{ C - Java Bluetooth Development on the PalmOS Platform
Appendix D -//
BlipNet
API are any devices that have been found by a recent inquiry,
If 1.1
there
Index
// we don't need to spend the time to complete an inquiry.
List of Figures
RemoteDevice[] devList = agent.retrieveDevices( DiscoveryAgent.CACHED );
List of Tablesif( devList != null )
{
List of Listings
List of Sidebars
if( searchServices(devList) )
{
return record;
}
}
// Did not find any echo servers from the list of cached devices.
// Will try to find an echo server in the list of pre-known devices.
devList = agent.retrieveDevices( DiscoveryAgent.PREKNOWN );
if( devList != null )
{
if( searchServices(devList) )
{
return record;
}
}
// Did not find an echo server in the list of pre-known or cached
// devices. So start an inquiry to find all devices that could be
// an echo server and do a search on those devices.
try
{
agent.startInquiry(DiscoveryAgent.GIAC, this);
Bluetooth for Java
by Bruce
Ranjith
//
WaitHopkins
untiland
all
the Antony
devices areISBN:1590590783
found before trying to start the
Apress
©
2003
(352
pages)
// service search.
The authors of this text describe how to develop wireless Java
synchronized(this)
{applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
try
Bluetooth-based
services, highlights of security concerns, and
more.{
this.wait();
}
Table of Contents
catch (Exception e) {}
Bluetooth for Java }
Introduction }
Chapter 1 -catch(
Introducing
Bluetooth
BluetoothStateException
e )
Chapter 2 -{Bluetooth 1.1
System.out.println(
"Unable to find devices to search" );
Chapter 3 - Before
You Get Started
Chapter 4 -}Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
deviceList.size()
> with
0 ) JPS API
-if(
Creating
a Bluetooth Print Server
Chapter 7
-{Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
Chapter 10
Chapter 11
Chapter 12
Appendix A
devList = new RemoteDevice[deviceList.size()];
deviceList.copyInto( devList );
- Bluetooth Security
if( searchServices(devList) )
- Wireless Embedded Systems with the Micro BlueTarget
{
- Enterprise Bluetooth Applications with the Ericsson BlipNet
return record;
- Bluetooth and Jini
}
-}javax.bluetooth
Appendix B - javax.obex
Appendix C -return
Java Bluetooth
Development on the PalmOS Platform
null;
Appendix
D
BlipNet
1.1
API
}
Index // This is the main method of this application.
List of Figures
public static void main(String[] args)
{
List of Tables
L2CAPEchoClient client = null;
List of Listings
List of Sidebars
// Validate the proper number of arguments exist when starting this
// application.
if( (args == null) || (args.length != 1) )
{
System.out.println( "usage: java L2CAPEchoClient <message>" );
return;
}
// Create a new EchoClient object.
try
{
client = new L2CAPEchoClient();
}
catch( BluetoothStateException e )
{
System.out.println( "Failed to start Bluetooth System" );
System.out.println( "BluetoothStateException: " + e.getMessage() );
}
// Find an Echo Server in the local area
ServiceRecord echoService = client.findEchoServer();
if(echoService
!= null )
Bluetooth for Java
{
ISBN:1590590783
by Bruce Hopkins and Ranjith Antony
//
retrieve
Apress
© 2003 (352the
pages)connection URL string
String conURL =
The authors of this text describe how to develop wireless Java
echoService.getConnectionURL(
false );
applications using Bluetooth for ServiceRecord.NOAUTHENTICATE_NOENCRYPT,
a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based
highlights
of security concerns, and
//
create a services,
new client
instance
more.
EchoClient echoClient = new EchoClient( conURL );
Table of Contents // and send the message give on the command line
echoClient.sendMessage( args[0] );
}
Introduction
else
Chapter 1 - Introducing Bluetooth
{
Chapter 2 - Bluetooth 1.1
System.out.println( "No Echo Server was found" );
Chapter 3 - Before You Get Started
}
Chapter
4 - Understanding the Java Bluetooth API
}
Bluetooth for Java
Chapter 5
- Bluetooth with J2ME MIDP
Chapter
6 - Creating
withduring
JPS API an inquiry. An inquiry
// Called
when aaBluetooth
device Print
wasServer
found
Chapter
7
Java
and
OBEX
// searches for devices that are discoverable. The same device may
Chapter
- Using a Bluetooth
Simulator
// be8 returned
multiple
times.
Chapter
public
9 void
- Bluetooth
deviceDiscovered(
Security
RemoteDevice btDevice, DeviceClass cod )
{
Chapter
10 - Wireless Embedded Systems with the Micro BlueTarget
"Found device
= " + BlipNet
btDevice.getBluetoothAddress() );
ChapterSystem.out.println(
11 - Enterprise Bluetooth Applications
with the Ericsson
btDevice );
ChapterdeviceList.addElement(
12 - Bluetooth and Jini
}
Appendix
A - javax.bluetooth
Appendix B - javax.obex
// The following method is called when a service search is completed or
// was terminated because of an error. Legal values include:
Appendix D - BlipNet 1.1 API
// SERVICE_SEARCH_COMPLETED, SERVICE_SEARCH_TERMINATED,
Index
// SERVICE_SEARCH_ERROR, SERVICE_SEARCH_DEVICE_NOT_REACHABLE
List of Figures
// and SERVICE_SEARCH_NO_RECORDS
List of Tables
public void serviceSearchCompleted( int transID, int respCode )
List
{ of Listings
List of Sidebars
System.out.println( "serviceSearchCompleted(" + transID + ", "+
respCode + ")" );
Appendix C - Java Bluetooth Development on the PalmOS Platform
// Removes the transaction ID from the transaction table.
removeFromTransactionTable( transID );
serviceSearchCount—;
synchronized( this )
{
this.notifyAll();
}
}
// Called when service(s) are found during a service search.
// This method provides the array of services that have been found.
public void servicesDiscovered( int transID, ServiceRecord[] servRecord )
{
// If this is the first record found, then store this record
// and cancel the remaining searches.
if( record == null )
{
System.out.println( "Found a service " + transID );
Bluetooth for Java "Length of array = " + servRecord.length );
System.out.println(
ISBN:1590590783
by Bruce Hopkins and
if( servRecord[0]
==Ranjith
null Antony
)
Apress
©
2003
(352
pages)
{
The authors of this text describe
how
to developrecord
wireless Java
System.out.println(
"The
service
is null" );
applications
using
Bluetooth
for
a
variety
of
platforms.
This
}
includes an API overview of the Java library, development of
record
= servRecord[0];
Bluetooth-based
services, highlights of security concerns, and
if( record
== null )
more.
{
System.out.println( "The second try was null" );
Table of Contents
}
Bluetooth for Java
Introduction // Cancel all the service searches that are presently
Chapter 1 -//
Introducing
being Bluetooth
performed.
Chapter 2
-for(
Bluetooth
int1.1i=0; i<transactionID.length; i++ )
Chapter 3
-{Before You Get Started
Chapter 4
if( transactionID[i]
!= -1 )
- Understanding
the Java Bluetooth API
Chapter 5
{
- Bluetooth
with J2ME MIDP
Chapter 6
System.out.println(agent.cancelServiceSearch(transactionID[i]));
- Creating
a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
}
}
}
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
}
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
// Called when a device discovery transaction is
Appendix
A - javax.bluetooth
// completed.
The <code>discType</code> will be
Appendix
B
- javax.obex
// INQUIRY_COMPLETED
if the device discovery transaction ended normally,
Appendix
C - Java Bluetooth
on the
PalmOS Platform
// INQUIRY_ERROR
if Development
the device
discovery
transaction failed
Appendix
- BlipNet 1.1
API
// to D
complete
normally,
Index
// INQUIRY_TERMINATED if the device discovery transaction
List
//ofwas
Figures
canceled by calling
//ofDiscoveryAgent.cancelInquiry().
List
Tables
public
void inquiryCompleted(int discType)
List
of Listings
{ of Sidebars
List
synchronized(this)
{
try
{
this.notifyAll();
}
catch (Exception e) {}
}
}
}
// The EchoClient will make a connection using the connection string
// provided and send a message to the server to print the data sent.
class EchoClient
{
// Keeps the connection string in case the application would like to make
// multiple connections to an echo server.
private String serverConnectionString;
// The constructor: creates an EchoClient object that will allow an
// application to send multiple messages to an echo server.
EchoClient( String server )
Bluetooth for Java
{
by Bruce Hopkins and Ranjith
Antony
serverConnectionString
= server;
Apress
©
2003
(352
pages)
}
ISBN:1590590783
The authors of this text describe how to develop wireless Java
using
for a variety of platforms. This
// Sends applications
a message
toBluetooth
the server.
includes an API overview of the Java library, development of
public boolean
sendMessage(
Stringof msg
) concerns, and
Bluetooth-based
services, highlights
security
{
more.
L2CAPConnection con = null;
byte[] data = null;
Table of Contents
int index = 0;
Bluetooth forbyte[]
Java
temp = null;
Introduction
Chapter 1
-try
Introducing Bluetooth
Chapter 2
-{Bluetooth 1.1
Chapter 3
//You
Create
a connection to the server
- Before
Get Started
Chapter 4
con = (L2CAPConnection)Connector.open(
serverConnectionString );
- Understanding
the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
// aDetermine
the
maximum
of data I can send to the server.
- Creating
Bluetooth Print
Server
with JPSamount
API
Chapter 7
MaxOutBufSize = con.getTransmitMTU();
- Java int
and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
temp = new byte[MaxOutBufSize];
// Send as many packets as are needed to send the data
data = msg.getBytes();
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
while( index < data.length )
Chapter 12 - Bluetooth and Jini
{
Appendix A - javax.bluetooth
// Determine if this is the last packet to send or if there
Appendix B - javax.obex // will be additional packets
Appendix C - Java Bluetooth
on the-PalmOS
Platform
if( Development
(data.length
index)
< MaxOutBufSize )
Appendix D - BlipNet 1.1{API
Index
temp = new byte[data.length - index];
List of Figures
System.arraycopy( data, index, temp, 0, data.length-index );
}
List of Tables
else
List of Listings
{
List of Sidebars
temp = new byte[MaxOutBufSize];
System.arraycopy( data, index, temp, 0, MaxOutBufSize );
}
con.send(temp);
index += MaxOutBufSize;
}
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
// Prepare a receive buffer
int rxlen = con.getReceiveMTU();
byte[] rxdata = new byte[rxlen];
// Wait to receive the server's reply (method blocks!)
rxlen = con.receive( rxdata );
// Here, we've got it
String message = new String( rxdata, 0, rxlen );
System.out.println( "Server replied: " + message );
// Close the connection to the server
con.close();
}
catch( BluetoothConnectionException e )
Bluetooth for Java
{
ISBN:1590590783
by Bruce Hopkins and Ranjith"Failed
Antony to send
System.out.println(
the message" );
Apress
©
2003
(352
pages)
System.out.println( "BluetoothConnectionException: " +
The authors of this text describe
how to develop wireless
e.getMessage()
); Java
applications
using
Bluetooth
for
a
variety
of
platforms.
This
System.out.println( "Status: " + e.getStatus()
);
includes an API overview of the Java library, development of
}
Bluetooth-based services, highlights of security concerns, and
catch(
IOException e )
more.
{
System.out.println( "Failed to send the message" );
Table of Contents System.out.println( "IOException: " + e.getMessage() );
Bluetooth for Java return false;
Introduction }
Chapter 1
- Introducing Bluetooth
Chapter 2
-return
Bluetoothtrue;
1.1
Chapter}3
- Before You Get Started
}
Chapter
4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 9
- Bluetooth Security
Wireless
System
Monitor
Example
Chapter
8 - Using
a Bluetooth
Simulator
In the Wireless System Monitor example, we're going to look at an industrial device that is in great need of wireless
communication: the Programmable Logic Controller (PLC). PLCs are industrial control devices that programmatically
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
control large machinery. They are widely used with manufacturing facilities to control relays, switches, motors, sensors,
Chapter
12 - Bluetooth
and Jini
test chambers,
assembly
lines, robotic arms—the list goes on and on.
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Appendix A - javax.bluetooth
Now a large
manufacturing facility is very likely to have a considerable number of PLCs, each doing a particular task.
Appendix
B - javax.obex
Now, if you
want Bluetooth
to monitorDevelopment
the status ofon
a particular
PLC,
you typically would have to walk over to the machine that
Appendix
C - Java
the PalmOS
Platform
you wantDto
inquire 1.1
about,
Appendix
- BlipNet
API and hook up a portable computer to the PLC's RS-232 interface. You would then run some
program on the computer that would read the data coming from the serial port of the PLC.
Index
List of Figures
This in itself can become a tedious process, especially if you're the guy who has to check the status on the PLCs.
Sometimes, the hardest part of the job is trying to hook up the serial cable. We're not kidding here; in some industrial
List
of Listings the PLC may be located in a hard to reach area, and the communication ports may be even harder to
environments,
List
of
Sidebars
reach.
As you can see, PLCs make good candidates to be converted into fixed-wireless systems.
List of Tables
As shown in Figure 10-10, with the addition of a Micro BlueTarget, a PLC can instantly become a fixed-wireless
system. The Micro BlueTarget will read the data from the RS-232 interface and transmit the data wirelessly with the
Serial Port Profile. All a status technician needs to do is to come within range of the PLC to gather the data.
Figure 10-10: Using the Micro BlueTarget to create a fixed-wireless system
SPP2COMM.java is a dual-purpose application that you could run on a Micro BlueTarget in order to read the data
from its serial port and transmit it wirelessly. When the Micro BlueTarget receives data coming in from its COMM port, it
will go into "server mode" and create a Serial Port Profile server and pipe the data from the COMM port to its Serial
Port Profile "port."
This same code could also be run on a JSR-82-enabled client in order to collect the data from the Micro BlueTarget.
Since the client isn't collecting data from its serial port, it will automatically go into "client mode" and create a Serial
Port Profile client. When the client receives data, it will try to pipe the data to its native serial port. The code for
forListing
Java 10-3.
SPP2COMM.javaBluetooth
is shown in
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
Apress © 2003 (352 pages)
Listing 10-3: SPP2COMM.java
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
import java.lang.*;
includes an API overview of the Java library, development of
import java.io.*;
Bluetooth-based services, highlights of security concerns, and
more.
import java.util.*;
import javax.microedition.io.*;
import javax.bluetooth.*;
Table of Contents
Bluetooth for Java
public class SPP2COMM implements DiscoveryListener
{
Chapter//
1 The
- Introducing
Bluetooth
connection
to the serial port
Chapterstatic
2 - Bluetooth
1.1
StreamConnection
serialport = null;
Introduction
Chapter 3
- Before You Get Started
Chapter//
4 The
- Understanding
the Java
Bluetooth to
API the local serial port
Input/Output
streams
Chapterstatic
5 - Bluetooth
with J2ME MIDP
OutputStream
ser_out = null;
Chapterstatic
6 - Creating
InputStream
a Bluetooth ser_in
Print Server
= with
null;
JPS API
Chapter 7
- Java and OBEX
Bluetooth
to the peer device
Chapter//
8 The
- Using
a Bluetooth connection
Simulator
static
StreamConnection
bluetoothport
= null;
Chapter 9 - Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Input/Output
streams with
to the
Bluetooth
Chapter//
11 The
- Enterprise
Bluetooth Applications
the Ericsson
BlipNet connection
static OutputStream bt_out = null;
static InputStream bt_in = null;
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
// The DiscoveryAgent for the local Bluetooth device.
private DiscoveryAgent agent;
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index // The max number of service searches that can occur at any one time.
List of Figures
private int maxServiceSearches = 0;
List of Tables
List of Listings
// The number of service searches that are presently in progress.
List of Sidebars
private int serviceSearchCount;
// Keeps track of the transaction IDs returned from searchServices.
private int transactionID[];
// The service record to a cable replacement service
private ServiceRecord record;
// Keeps track of the devices found during an inquiry.
private Vector deviceList;
// The constructor: creates an SPP2COMM and prepares the object
// for device discovery and service searching.
public SPP2COMM() throws BluetoothStateException
{
// Retrieve the local Bluetooth device object.
LocalDevice local = LocalDevice.getLocalDevice();
// Retrieve the DiscoveryAgent object that allows us to perform device
// and service discovery.
agent = local.getDiscoveryAgent();
// Retrieve the max number of concurrent service searches that can
// exist at any one time.
try Bluetooth for Java
ISBN:1590590783
by Bruce Hopkins and Ranjith Antony
{
Apress
©
2003
(352
pages)
maxServiceSearches =
The
authors of this text describe
how to develop wireless Java
Integer.parseInt(
LocalDevice.getProperty("bluetooth.sd.trans.max"));
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
}
Bluetooth-based services, highlights of security concerns, and
catch(
NumberFormatException e )
more.
{
System.out.println( "General Application Error" );
Table of Contents System.out.println( "NumberFormatException: " + e.getMessage() );
Bluetooth for}Java
Introduction
Chapter 1
Chapter 2
-transactionID
Introducing Bluetooth
= new int[maxServiceSearches];
- Bluetooth 1.1
Chapter 3
Initialize
the transaction list
-//
Before
You Get Started
Chapter 4
int i=0;
i<maxServiceSearches;
i++ )
-for(
Understanding
the Java
Bluetooth API
Chapter 5
-{Bluetooth with J2ME MIDP
Chapter 6
transactionID[i]
= -1;
- Creating
a Bluetooth Print Server
with JPS API
Chapter 7
-}Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
}
record = null;
deviceList = new Vector();
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
// Adds the transaction table with the transaction ID provided.
private void addToTransactionTable( int trans )
Appendix
{ A - javax.bluetooth
Appendix B -for(
javax.obex
int i=0; i<transactionID.length; i++ )
Appendix C -{Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet
1.1transactionID[i]
API
if(
== -1 )
Index
{
List of Figures
transactionID[i] = trans;
return;
List of Tables
}
List of Listings
}
List of Sidebars
}
Chapter 12 - Bluetooth and Jini
// Removes the transaction from the transaction ID table.
private void removeFromTransactionTable( int trans )
{
for( int i=0; i<transactionID.length; i++ )
{
if( transactionID[i] == trans )
{
transactionID[i] = -1;
return;
}
}
}
// Completes a service search on each remote device in the list until all
// devices are searched or until a cable replacement peer is found that this
// application can connect to.
private boolean searchServices( RemoteDevice[] devList )
{
UUID[] searchList = new UUID[2];
// Add
the UUID
for L2CAP to make sure that the service record
Bluetooth
for Java
// found
will
support
L2CAP.
is defined in the
ISBN:1590590783
by Bruce Hopkins and Ranjith
Antony This value
// Bluetooth
Assigned
Numbers
document.
Apress © 2003 (352 pages)
searchList[0] = new UUID(0x0100);
The authors of this text describe how to develop wireless Java
// Add
the UUID
the cable
replacement
that we are going
applications
usingfor
Bluetooth
for a variety
of platforms. service
This
// toincludes
use to
theoverview
list of
ofthe
UUIDs
to search
for.of
an API
Java library,
development
Bluetooth-based
services, highlights
of security concerns,
and
// This
is a fictional
cable replacement
service
UUID
more.
searchList[1] = new UUID( "FFEEDDCCBBAA998877665544332211", false );
// Start a search on as many devices as the system can support.
Table of Contents
for (int i = 0; i < devList.length; i++)
{
Introduction
System.out.println( "Length = " + devList.length );
Bluetooth for Java
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
-
Chapter 5
-
Chapter 6
-
Chapter 7
-
Chapter 8
-
Chapter 9
- Bluetooth Security
// If we found a service record for the cable replacement service, then
// we can end the search.
Understanding
the Java
Bluetooth
if (record
!=
null) API
Bluetooth
with
J2ME
MIDP
{
Creating a Bluetooth
Print Server with JPS"Record
API
System.out.println(
is not null" );
Java and OBEX
return true;
Using a}Bluetooth Simulator
try
Chapter 10 - Wireless
Embedded Systems with the Micro BlueTarget
{ Bluetooth Applications with the Ericsson BlipNet
Chapter 11 - Enterprise
System.out.println(
"Starting Service Search on " +
Chapter 12 - Bluetooth and
Jini
devList[i].getBluetoothAddress() );
int
trans
=
agent.searchServices(null,
searchList, devList[i], this );
Appendix B - javax.obex
System.out.println(
"Starting
Service
Search " + trans );
Appendix C - Java Bluetooth Development on the PalmOS Platform
addToTransactionTable( trans );
Appendix D - BlipNet 1.1 API
}
Index
catch (BluetoothStateException e)
List of Figures
{
List of Tables
// Failed to start the search on this device, try another device.
List of Listings
System.out.println( "BluetoothStateException: " + e.getMessage() );
List of Sidebars
}
Appendix A - javax.bluetooth
// Determine if another search can be started. If not, wait for
// a service search to end.
synchronized(this)
{
serviceSearchCount++;
System.out.println( "maxServiceSearches = " + maxServiceSearches );
System.out.println( "serviceSearchCount = " + serviceSearchCount );
if( serviceSearchCount == maxServiceSearches )
{
System.out.println( "Waiting" );
try
{
this.wait();
}
catch(Exception e) {}
}
System.out.println( "Done Waiting " + serviceSearchCount );
}
}
// Wait until all the service searches have completed.
Bluetooth for Java
while(serviceSearchCount
> 0)
ISBN:1590590783
by Bruce Hopkins and Ranjith Antony
{
Apress
©
2003
(352
pages)
synchronized (this)
{The authors of this text describe how to develop wireless Java
applications
try using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
{
Bluetooth-based
services, highlights of security concerns, and
this.wait();
more.
}
catch (Exception e) {}
Table of Contents }
Bluetooth for}Java
Introduction
Chapter 1
Chapter 2
-if(
Introducing
Bluetooth
record
!= null )
-{Bluetooth 1.1
Chapter 3
System.out.println(
"Record is not null" );
- Before
You Get Started
Chapter 4
return the
true;
- Understanding
Java Bluetooth API
Chapter 5
-}Bluetooth with J2ME MIDP
Chapter 6
-else
Creating a Bluetooth Print Server with JPS API
Chapter 7
-{Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
System.out.println( "Record is null" );
return false;
}
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
}
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
// Finds the first cable replacement peer that is available to connect to.
Appendix
A - javax.bluetooth
public
ServiceRecord findCableReplacementService()
Appendix
B
{ - javax.obex
Appendix C -//
JavaIf
Bluetooth
on the PalmOS
there Development
are any devices
thatPlatform
have been found by a recent inquiry,
Appendix D -//
BlipNet
1.1
API
we don't need to spend the time to complete an inquiry.
Index
RemoteDevice[] devList = agent.retrieveDevices(DiscoveryAgent.CACHED);
List of Figures
if( devList != null )
List of Tables{
List of Listings
List of Sidebars
if( searchServices(devList) )
{
return record;
}
}
// Did not find any cable replacement peer from the list of cached devices.
// Will try to find a cable replacement peer in the list of
// pre-known devices.
devList = agent.retrieveDevices( DiscoveryAgent.PREKNOWN );
if( devList != null )
{
if( searchServices(devList) )
{
return record;
}
}
// Did not find a cable replacement peer in the list of pre-known or
// cached devices. So start an inquiry to find all devices that could be
// a cable replacement peer and do a search on those devices.
try
{
agent.startInquiry(DiscoveryAgent.GIAC, this);
Bluetooth for Java
by Bruce
Ranjith
//
WaitHopkins
untiland
all
the Antony
devices areISBN:1590590783
found before trying to start the
Apress
©
2003
(352
pages)
// service search.
The authors of this text describe how to develop wireless Java
synchronized(this)
{applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
try
Bluetooth-based
services, highlights of security concerns, and
more.{
this.wait();
}
Table of Contents
catch (Exception e) {}
Bluetooth for Java }
Introduction }
Chapter 1 -catch(
Introducing
Bluetooth
BluetoothStateException
e )
Chapter 2 -{Bluetooth 1.1
System.out.println(
"Unable to find devices to search" );
Chapter 3 - Before
You Get Started
Chapter 4 -}Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
deviceList.size()
> with
0 ) JPS API
-if(
Creating
a Bluetooth Print Server
Chapter 7
-{Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
Chapter 10
Chapter 11
Chapter 12
Appendix A
devList = new RemoteDevice[deviceList.size()];
deviceList.copyInto( devList );
- Bluetooth Security
if( searchServices(devList) )
- Wireless Embedded Systems with the Micro BlueTarget
{
- Enterprise Bluetooth Applications with the Ericsson BlipNet
return record;
- Bluetooth and Jini
}
-}javax.bluetooth
Appendix B - javax.obex
Appendix C -return
Java Bluetooth
Development on the PalmOS Platform
null;
Appendix
D
BlipNet
1.1
API
}
Index
List of Figures
// This is the main method of this application.
public static void main(String[] args)
List of Tables
{
List of Listings
SPP2COMM client = null;
List of Sidebars
SppServerProcess server = null;
int baudrate;
// Validate the proper number of arguments exist when starting
// this application.
if( (args == null) || (args.length != 1) )
{
System.out.println( "usage: java SPP2COMM <baudrate>" );
return;
}
// Create a new SPP2COMM object.
try
{
client = new SPP2COMM();
}
catch( BluetoothStateException e )
{
System.out.println( "Failed to start Bluetooth System" );
System.out.println( "BluetoothStateException: " + e.getMessage() );
}
// get
the baudrate
Bluetooth
for Java for the serial port from the command line
baudrate
=
Integer.parseInt(
args[0] ISBN:1590590783
);
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
// make the connection to the serial port
The authors of this text describe how to develop wireless Java
try {applications using Bluetooth for a variety of platforms. This
//
get an
the
includes
API connection
overview of the Java library, development of
Bluetooth-based=services,
highlights of security concerns, and
serialport
(StreamConnection)Connector.open(
"comm:1;baudrate=" +
more.
baudrate, Connector.READ_WRITE, true );
}
catch( Exception e )
Table of Contents
{
Bluetooth for Java
System.out.println( "serial port open exception: " + e );
Introduction
System.exit( 0 );
Chapter 1 - Introducing Bluetooth
}
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
-try
Understanding the Java Bluetooth API
Chapter 5
-{Bluetooth with J2ME MIDP
Chapter 6
- Creating
a Bluetooth
Print Server with JPS API
ser_out
= serialport.openOutputStream();
Chapter 7
-}Java and OBEX
Chapter 8
-catch(
Using a Bluetooth
Simulator
Exception
e )
// open the serial port's output stream
Chapter 9
-{Bluetooth Security
System.out.println(
output stream open exception: " + e );
Chapter 10 - Wireless
Embedded Systems with "serial
the Micro BlueTarget
System.exit(
0 );
Chapter 11 - Enterprise
Bluetooth Applications
with the Ericsson BlipNet
Chapter 12 -}Bluetooth and Jini
Appendix A - javax.bluetooth
open the serial port's input stream
Appendix B -//
javax.obex
try
{
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of
List of
List of
List of
ser_in = serialport.openInputStream();
}
Figures
catch( Exception e )
Tables
{
Listings
System.out.println( "serial input stream open exception: " + e );
Sidebars
System.exit( 0 );
}
// Create a new SPP server object.
try
{
server = new SppServerProcess();
server.start();
}
catch( Exception e )
{
System.out.println( "Failed to start Spp Server" + e );
System.exit( 0 );
}
// the main loop runs forever. However, it can be stopped
// by terminating the KVM from the command line
while( true )
{
// Create buffer to receive data from the serial port
byte[] rxdata = new byte[64];
int
rxlen=0;
int
data;
Bluetooth for Java
ISBN:1590590783
by Bruce Hopkins and Ranjith Antony
try
Apress
©
2003
(352
pages)
{
The authors
of this
how to develop
Java port
// read
intext
asdescribe
many bytes
from wireless
the serial
applications
using
Bluetooth
for
a
variety
of
platforms.
This
// as currently available but do not exceed the
includes an API overview of the Java library, development of
// current
buffer
length.
Bluetooth-based
services,
highlights
of security concerns, and
more.// The read() method blocks but is periodically released
// by an InterruptedIOException in order to allow other
// things to happen meanwhile
Table of Contents
while( true )
Bluetooth for Java
{
Introduction
data = ser_in.read();
Chapter 1 - Introducing Bluetooth
rxdata[rxlen] = (byte)data;
Chapter 2 - Bluetooth 1.1
rxlen++;
if( rxlen >= 64 || data == -1 )
Chapter 3 - Before You Get Started
break;
Chapter 4 - Understanding the Java
Bluetooth API
} J2ME MIDP
Chapter 5 - Bluetooth with
"data
Chapter 6 - Creating a System.out.println(
Bluetooth Print Server with JPS
API received from serial port, len=" +
rxlen );
Chapter 7 - Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 Chapter 11 Chapter 12 Appendix A Appendix B Appendix C Appendix D -
}
catch( InterruptedIOException e )
Wireless Embedded Systems with the Micro BlueTarget
{
Enterprise Bluetooth Applications with the Ericsson BlipNet
System.out.println( "serial port receive timeout: " + e );
Bluetooth and Jini
}
javax.bluetooth
catch( Exception e )
javax.obex
{
Java Bluetooth
Development on the PalmOS
Platform
System.out.println(
"serial
port receive exception: " + e );
BlipNet
1.1
API
}
Index
List of Figures
// Did we get any data from the serial port?
if( rxlen > 0 )
{
List of Listings
// Do we have a Bluetooth connection already?
List of Sidebars
if( bluetoothport != null )
{
// Do we have an OutputStream on the BT connection already?
if( bt_out == null )
{
// no, then create one
try
{
bt_out = bluetoothport.openOutputStream();
}
catch( Exception e )
{
System.out.println( "Bluetooth output stream open exception: " + e );
List of Tables
}
}
System.out.println( "send serial data on Bluetooth link" );
try
{
bt_out.write( rxdata );
bt_out.flush();
}
Bluetooth
for Java
catch(
Exception e )
ISBN:1590590783
by Bruce
Hopkins
and Ranjith Antony
{
Apress
©
2003
(352
pages)
System.out.println("Bluetooth output stream write exception: " + e);
The authors
of this text describe how to develop wireless Java
}
applications
using
Bluetooth for a variety of platforms. This
}
includes an API overview of the Java library, development of
else
Bluetooth-based services, highlights of security concerns, and
{more.
System.out.println( "No Bluetooth link: try to establish one..." );
Table of Contents
Bluetooth for Java
Introduction
// Find a cable replacement service in the local area
ServiceRecord cableReplacementService =
client.findCableReplacementService();
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
if( cableReplacementService != null )
Chapter 3
- Before You{Get Started
Chapter 4
//Java
retrieve
- Understanding the
Bluetooth the
API connection URL string
Chapter 5
String
- Bluetooth with J2ME
MIDP conURL =
Chapter 6
cableReplacementService.getConnectionURL(
- Creating a Bluetooth Print
Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
ServiceRecord.NOAUTHENTICATE_NOENCRYPT, false );
try
{
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
// Create a connection to the SPP peer
bluetoothport =
(StreamConnection)Connector.open( conURL );
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth }
Appendix B - javax.obex
catch(Exception e)
Appendix C - Java Bluetooth Development
on the PalmOS Platform
{
Appendix D -System.out.println(
BlipNet 1.1 API
"Failed to establish Bluetooth link: " + e );
Index
}
List of Figures
if( bluetoothport != null )
{
try
List of Sidebars
{
// open an OutputStream on the Bluetooth connection
bt_out = bluetoothport.openOutputStream();
}
catch( Exception e )
{
System.out.println( "Bluetooth output stream open exception: " + e );
}
List of Tables
List of Listings
// and send the data from the serial port
System.out.println( "send serial data on Bluetooth link" );
try
{
bt_out.write( rxdata );
bt_out.flush();
}
catch( Exception e )
{
System.out.println( "Bluetooth output stream write exception: " + e );
}
}
}
Bluetooth
else for Java
}
ISBN:1590590783
by Bruce
{ Hopkins and Ranjith Antony
Apress © 2003
(352
pages)
System.out.println( "No SPP peer found" );
The authors
of this text describe how to develop wireless Java
}
applications
using
Bluetooth for a variety of platforms. This
}
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
// do we have a Bluetooth connection already?
if( bluetoothport != null )
Table of Contents
{
Bluetooth for Java
// do we have an InputStream on the Bluetooth connection already?
Introduction
if( bt_in == null )
Chapter 1 - Introducing
Bluetooth
{
Chapter 2 - Bluetooth
//1.1no, then create one
tryGet Started
Chapter 3 - Before You
{
Chapter 4 - Understanding
the Java Bluetooth API
= bluetoothport.openInputStream();
Chapter 5 - Bluetooth withbt_in
J2ME MIDP
Chapter 6 - Creating}a Bluetooth Print Server with JPS API
Exception e )
Chapter 7 - Java andcatch(
OBEX
{
Chapter 8 - Using a Bluetooth Simulator
System.out.println("Bluetooth output stream open exception: " + e );
Chapter 9 - Bluetooth Security
}
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
}
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
// listen on the bluetooth connection
Appendix A - javax.bluetooth
rxlen = 0;
Appendix B - javax.obex
try
Appendix C - Java
{ Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet//
1.1read
API
in as many bytes from the serial port
Index
// as currently available but do not exceed the
List of Figures
// current buffer length.
// The read() method blocks but is periodically released
// by an InterruptedIOException in order to allow other
List of Listings
// things to happen meanwhile
List of Sidebars
while( true )
{
data = bt_in.read();
rxdata[rxlen] = (byte)data;
rxlen++;
if( rxlen >= 64 || data == -1 )
break;
}
System.out.println( "data received from bluetooth port, len=" + rxlen );
List of Tables
}
catch( InterruptedIOException e )
{
System.out.println( "Bluetooth port receive timeout: " + e );
}
catch( Exception e )
{
System.out.println( "Bluetooth port receive exception: " + e );
}
try
{
System.out.println( "send Bluetooth data on serial link" );
Bluetooth for
Java
ser_out.write(
rxdata );
ISBN:1590590783
by Bruce Hopkins
and Ranjith Antony
ser_out.flush();
Apress }
© 2003 (352 pages)
The authors
of this
text describeehow
catch(
Exception
) to develop wireless Java
applications
using
Bluetooth
for
a
variety
of platforms. This
{
includes an API overview of the Java library, development of
System.out.println(
"Bluetooth
stream and
write exception: " + e );
Bluetooth-based services,
highlights of output
security concerns,
more. }
}
}
Table of
} Contents
Bluetooth for Java
Introduction
// Called when a device was found during an inquiry. An inquiry
Chapter//
1 searches
- Introducingfor
Bluetooth
devices that are discoverable. The same device may
Chapter//
2 be
- Bluetooth
returned
1.1 multiple times.
void
btDevice, DeviceClass cod)
Chapterpublic
3 - Before
YoudeviceDiscovered(RemoteDevice
Get Started
Chapter{4
- Understanding the Java Bluetooth API
Chapter 5
-System.out.println(
Bluetooth with J2ME MIDP "Found device = " + btDevice.getBluetoothAddress() );
Chapter 6
-deviceList.addElement(
Creating a Bluetooth Print ServerbtDevice
with JPS API);
Chapter}7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
// The following method is called when a service search is completed or
- Bluetooth Security
// was terminated because of an error. Legal values include:
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
// SERVICE_SEARCH_COMPLETED, SERVICE_SEARCH_TERMINATED,
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
// SERVICE_SEARCH_ERROR, SERVICE_SEARCH_DEVICE_NOT_REACHABLE
Chapter 12 - Bluetooth and Jini
// and SERVICE_SEARCH_NO_RECORDS
Appendix
A - javax.bluetooth
public
void serviceSearchCompleted( int transID, int respCode )
Appendix
B
{ - javax.obex
Appendix
C - Java Bluetooth Development
on the PalmOS Platform + transID +
System.out.println(
"serviceSearchCompleted("
Appendix D - BlipNet 1.1 API
", " + respCode + ")" );
Chapter 9
Index
List of Figures
// Removes the transaction ID from the transaction table.
List of TablesremoveFromTransactionTable( transID );
List of Listings
serviceSearchCount—;
List of Sidebars
synchronized(this)
{
this.notifyAll();
}
}
// Called when service(s) are found during a service search.
// This method provides the array of services that have been found.
public void servicesDiscovered(int transID, ServiceRecord[] servRecord)
{
// If this is the first record found, then store this record
// and cancel the remaining searches.
if( record == null )
{
System.out.println( "Found a service " + transID );
System.out.println( "Length of array = " + servRecord.length );
if( servRecord[0] == null )
{
System.out.println( "The service record is null" );
}
record = servRecord[0];
System.out.println( "After this" );
Bluetooth
for Java
if( record
== null )
ISBN:1590590783
by
Bruce
Hopkins
and Ranjith Antony
{
Apress System.out.println(
© 2003 (352 pages)
"The Second try was null" );
The
} authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
// Cancel all
the highlights
serviceof searches
that and
are presently
Bluetooth-based
services,
security concerns,
// being performed.
more.
for( int i=0; i<transactionID.length; i++ )
{
Table of Contents
if( transactionID[i] != -1 )
Bluetooth for Java
{
Introduction
Chapter
1 - Introducing Bluetooth
System.out.println(agent.cancelServiceSearch(transactionID[i]));
Chapter 2
- Bluetooth 1.1
}
Chapter 3
- Before }You Get Started
Chapter 4
}
- Understanding
the Java Bluetooth API
Chapter}5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter//
7 Called
- Java andwhen
OBEX a device discovery transaction is
// completed.
The <code>discType</code> will be
- Using a Bluetooth Simulator
// INQUIRY_COMPLETED if the device discovery transactions ended normally,
Chapter 9 - Bluetooth Security
// INQUIRY_ERROR if the device discovery transaction failed
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
// to complete normally,
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
// INQUIRY_TERMINATED if the device discovery transaction was canceled
Chapter 12 - Bluetooth and Jini
// by calling DiscoveryAgent.cancelInquiry().
Appendix
A - javax.bluetooth
public
void inquiryCompleted( int discType )
Appendix
B
{ - javax.obex
Appendix C -synchronized(
Java Bluetooth Development
this ) on the PalmOS Platform
Appendix D -{BlipNet 1.1 API
Index
try
List of Figures
{
this.notifyAll();
List of Tables
}
List of Listings
catch (Exception e) {}
List of Sidebars
}
}
}
Chapter 8
class SppServerProcess extends Thread
{
/* the constructor */
SppServerProcess()
{
}
public void run()
{
StreamConnectionNotifier Server = null;
try
{
LocalDevice local = LocalDevice.getLocalDevice();
local.setDiscoverable( DiscoveryAgent.GIAC );
}
catch( BluetoothStateException e )
{
Bluetooth for Java
System.err.println(
"Failed to start service" );
ISBN:1590590783
by Bruce Hopkins and Ranjith"BluetoothStateException:
Antony
System.err.println(
" + e.getMessage() );
Apress
©
2003
(352
pages)
return;
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
try Bluetooth-based services, highlights of security concerns, and
{
more.
}
// start the SPP server (with a fictional UUID)
Server = (StreamConnectionNotifier)Connector.open(
Table of Contents
"btspp://localhost:FFEEDDCCBBAA99887766554433221100" );
Bluetooth for}Java
Introduction catch( IOException e )
Chapter 1 -{Introducing Bluetooth
Chapter 2 - Bluetooth
System.err.println(
1.1
"Failed to start service" );
System.err.println(
"IOException: " + e.getMessage() );
Chapter 3 - Before
You Get Started
return;the Java Bluetooth API
Chapter 4 - Understanding
Chapter 5 -}Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
SPP Server");
-System.out.println("Starting
Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
while( true )
{
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
// accept connections only if we are not yet connected
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
if( SPP2COMM.bluetoothport == null )
Chapter 12 - Bluetooth and Jini
{
Appendix A - javax.bluetooth
try
Appendix B - javax.obex {
Appendix C - Java Bluetooth Development
on the
PalmOS Platform
// wait for
incoming
client connections (blocking method)
Appendix D - BlipNet 1.1 API SPP2COMM.bluetoothport = Server.acceptAndOpen();
Index
}
List of Figures
catch( IOException e )
{
List of Tables
System.out.println("IOException: "+ e.getMessage());
List of Listings
}
List of Sidebars
}
try
{
Thread.sleep( 1000 );
}
catch( Exception e ) { }
}
}
}
Client Options
Once you get data feeding the Micro BlueTarget and have SPP2COMM running on it, then you're all set from the
server's point of view; you have created a fixed-wireless system. Now on the client side of things, you have a few
options. Let's say that the vendor of the PLC makes a program to read and interpret the data from the PLC (when
connected serially, of course). You really don't need to use the SPP2COMM in client mode at all; all you need to do is
Bluetooth-enable your laptop and pair it with the Micro BlueTarget. The vendor's program will read the data from the
PLC (via the Micro BlueTarget) through COMM7 or COMM8 (which are typical Serial Port Profile ports) instead of
COMM1 or COMM2.
Now let's say that all the preceding conditions exist, but for some reason you can't Bluetooth-enable the laptop that will
Bluetooth for Java
read the data from the PLC. Don't worry, there's hope for you too! All you need to do is attach another Micro
by non-Bluetooth-enabled
Bruce Hopkins and Ranjith
Antony
BlueTarget to your
laptop
and run the ISBN:1590590783
SPP2COMM program. Since this Micro BlueTarget is not
Apress © 2003 (352 pages)
collecting data over its serial port, it will automatically run in client mode and look for a Serial Port Profile server. It will
The
authors
of thisPort
textProfile
describe
how to
develop
wireless
then read the data
from
the Serial
server,
and
pipe that
dataJava
to its own serial port. Your laptop can then use
applications using Bluetooth for a variety of platforms. This
the vendor program
to
read
and
interpret
the
PLC
data
(this
time
via
two
Micro BlueTargets) through a traditional serial
includes an API overview of the Java library, development of
port like COMM1Bluetooth-based
or COMM2. In this
case, highlights
you have made
a serial-to-wireless
services,
of security
concerns, and bridge.
more.
Now let's say that you're in a very special situation in that the vendor doesn't make a program to read and interpret the
data from the PLC. Now, you can be really creative and just make your own! In this case all you need is a JSR-82Table
of Contents
enabled
client device (like a PDA or laptop), and you have to make a slight modification to SPP2COMM program. For
Bluetooth
Javapart of it, instead of sending the data to the COMM port, just interpret, display, or process it.
the clientfor
mode
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Summary
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
In this chapter, you
were©introduced
to one of the first fully functional computing systems that is JSR-82
Apress
2003 (352 pages)
compliant: the Micro
BlueTarget.
You
should
be fully
aware
of its
physical
aspects for computational
The authors of this text
describe
how to
develop
wireless
Java
power, data connectivity,
and
wireless
communication.
You
should
also
be
applications using Bluetooth for a variety of platforms. This familiar with HyNetOS, the
an APIBlueTarget.
overview of the Java library, development of
operating systemincludes
for the Micro
Bluetooth-based services, highlights of security concerns, and
more.
Due to its small form
factor, low power requirements, and extensibility, the Micro BlueTarget is a great
device to create fixed-wireless systems and proofs of concepts for wireless applications. In Chapter 11,
we'll explore what it takes to create scalable and robust wireless applications in Bluetooth that can handle
Table of Contents
more than just seven concurrent users.
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
for Java
Chapter Bluetooth
11: Enterprise
Bluetooth
Applications with
ISBN:1590590783
by Bruce Hopkins and Ranjith Antony
Apress © 2003
(352 pages)
the Ericsson
BlipNet
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
As you have seenmore.
in the previous chapters of this book, the JSR-82 is a great API for creating Bluetooth
Overview
applications with the Java language. With any vendor implementation of the JSR-82, you can create
hundreds of client-server, peer-to-peer, cable replacement, and fixed-wireless Bluetooth applications.
Table of Contents
However, this API falls short when you need to create enterprise Bluetooth applications. So what's an
Bluetooth for Java
enterprise Bluetooth application? Well, here are the major qualifications of an enterprise Bluetooth
Introduction
application:
Chapter 1
- Introducing Bluetooth
Chapter
2 - Bluetooth
1.1 more than just seven active connections
Capability
to handle
Chapter 3 - Before You Get Started
A connection
range greater
than
just 30 API
or 300 ft
Chapter
4 - Understanding
the Java
Bluetooth
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Centralized communication to the devices (also called nodes) that comprise your network
Chapter
7 - Java
OBEX groups of nodes
A means
forand
managing
Chapter 8 - Using a Bluetooth Simulator
A means
for session
management when clients move between nodes
Chapter
9 - Bluetooth
Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Note Of course, Class 1 Bluetooth devices have a range of 300 ft, but you must realize that if the
Chapter 11 client
- Enterprise
Bluetooth
Applications
with
themost
Ericsson
BlipNet
is a Class
2 or Class
3 device
(like
mobile
phones and PDAs), then it doesn't matter
Chapter 12 if- the
Bluetooth
and
Jini
server is a Class 1 device (like some LAN access points).
Appendix A - javax.bluetooth
The JSR-82
was not created to handle enterprise Bluetooth applications, and doesn't provide any way to
Appendix
B - javax.obex
address Cthe
problems
thatDevelopment
enterprise Bluetooth
applications
can solve.
Appendix
- Java
Bluetooth
on the PalmOS
Platform
Appendix D - BlipNet 1.1 API
Consider the locations where Bluetooth applications will be widely deployed, like shopping malls, airports,
museums, office buildings, and grocery stores. At a mall, for instance, the scaling issue is very important.
List of Figures
It's not practical to create a Bluetooth-enabled information kiosk at a mall without being able to scale up to
List
of Tables
handle
more than just seven active connections. In order to accomplish this, your enterprise Bluetooth
List
of
Listings will contain more than a single Bluetooth-enabled node.
applications
Index
List of Sidebars
Centralized communication is an important feature in enterprise Bluetooth applications because there's no
way to implement group management or session management without it. For instance, in a Bluetoothenabled museum exhibit, there should be a way to activate or deactivate a group of nodes without
disturbing the other nodes on the network. Session management comes into play in a Bluetooth-enabled
retail location like a grocery store. Without session management, a customer may be offered the same ecoupon multiple times when passing by a different node in a grocery store.
In an office building, providing wireless network access to Bluetooth-enabled clients is a common
enterprise Bluetooth application. Session management in this scenario is also important so that clients can
freely roam around the building without having to reauthenticate when they go in and out of range of
different nodes.
In order to create enterprise Bluetooth applications, you need more than just a single Bluetooth device and
an API. Enterprise Bluetooth applications also require an infrastructure to be in place that will allow your
system to be scalable and robust.
Bluetooth
for Java
The Ericsson
BlipNet
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
The Ericsson BlipNet
contains
thepages)
infrastructure, functionality, and scalability that will allow developers to
Apress
© 2003 (352
create enterpriseThe
Bluetooth
applications
using thehow
Java
language.
An architecture
diagram of the Ericsson
authors of this text describe
to develop
wireless
Java
BlipNet is shown applications
in Figure 11-1.
using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter
9 - 11-1:
Bluetooth
Security
Figure
An architecture
diagram of the Ericsson BlipNet
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Note Although the Ericsson BlipNet allows you to create enterprise Bluetooth applications in Java, it
does not support the JSR-82. The JSR-82 is oriented toward creating applications where a
Appendix A - javax.bluetooth
single Bluetooth device communicates to other devices in a piconet. The BlipNet API is oriented
Appendix B - javax.obex
toward managing a network of Bluetooth-enabled nodes, where each node has the capability to
Appendix C - Java Bluetooth Development on the PalmOS Platform
interact with Bluetooth-enabled clients.
Chapter 12 - Bluetooth and Jini
Appendix D - BlipNet 1.1 API
Index
BlipNet Architecture
List of Figures
List of Tables
The core part of the BlipNet system is the BlipServer. The BlipServer itself is not Bluetooth enabled at all.
It does, however, have a direct TCP/IP connection to each of the BlipNodes (which are Bluetooth enabled)
List
Sidebarsthem via Java RMI. In order to create your enterprise Bluetooth applications, you write J2SE
andofcontrols
classes that interface with the BlipNet API. Now, since you're writing J2SE code here, you may realize that
there's nothing preventing you from accessing external resources on behalf of your Bluetooth-enabled
clients. In fact, that's the whole point of it. Using the Ericsson BlipNet, external resources such as
databases, LDAP directories, Web servers, and e-mail servers are all available at your client's disposal (as
long as you can access them via a Java API). This is reflected in Figure 11-2.
List of Listings
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
Understanding the Java Bluetooth API
Figure- 11-2:
You can use the BlipNet API and custom J2SE code to access external resources like
Chapter
5 - Bluetooth
with J2ME
databases,
directories,
and MIDP
e-mail servers.
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
BlipServer
Chapter
8 - Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
The BlipServer does not require any specialized hardware and can run on either Windows or Linux
operating systems. The statistics on the BlipServer are pretty impressive: a Pentium 400 MHz computer
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
with 256MB of RAM can manage 200 BlipNodes!
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 12 - Bluetooth and Jini
Appendix
A - javax.bluetooth
BlipNodes
Appendix B - javax.obex
Appendix
In an enterprise
C - Java Bluetooth
Bluetooth Development
application, the
on BlipServer
the PalmOScannot
Platform
directly communicate to your Bluetooth-
enabledDclients;
it has
interface with the BlipNodes. Each BlipNode is capable of multipoint
Appendix
- BlipNet
1.1 to
API
communication and includes the following profiles to interact with clients:
Index
List of Figures
Generic Access Profile
List of Tables
List ofService
Listings Discovery Application Profile
List of Sidebars
LAN Access Profile
Object Push Profile
Note The BlipNodes also conform to the WAP over Bluetooth interoperability requirements as defined
in the Bluetooth specification.
Your enterprise Bluetooth application will listen for events from the BlipNodes and act accordingly. For
instance, let's say that you want to track where employees are in the building (assuming, of course, that
they are wearing Bluetooth-enabled ID badges). When users come within range of a BlipNode, your
application will listen to device-discovered events via the Generic Access Profile. The BlipNet system is
sophisticated enough to let you know which BlipNode detected a user, so all you need to do is store that
data in a database, and create another application to view the results.
Now let's say that you're the manager of a hotel, and you want to allow your customers with Bluetoothenabled devices to send e-mails wirelessly from within the conference rooms. At these "e-mail stations,"
the BlipNodes will use the Object Push Profile to send clients the custom e-mail application (of course, this
works well if the app is a JSR-82 application). Clients compose their e-mail using the custom application,
and when they are ready to send the e-mail, they simply come within range of an e-mail station and push
the e-mail OBEX object to the BlipNode. On the BlipServer, your enterprise Bluetooth application will be
listening for an Object Push event, and will connect to an e-mail server to send the e-mail on behalf of the
hotel guest.
Bluetooth
for Java
Note This might
be a perfect
time for you to try creating custom headers for your OBEX e-mail object.
Bruce Hopkins
Antony a customISBN:1590590783
There'sby
nothing
stoppingand
youRanjith
from defining
header for the "to", "from", and "subject"
Apress
© 2003 (352 pages)
fields for
the e-mail.
The authors of this text describe how to develop wireless Java
As you can see, the
wireless using
e-mailBluetooth
station scenario
clearly
demonstrates
applications
for a variety
of platforms.
This the difference between the
includes an
API JSR-82
overviewand
of the
library,
development
of you can create the client app
programming paradigms
of the
theJava
BlipNet.
Using
the JSR-82,
Bluetooth-based
services,
highlights
concerns,
and
that generates the
e-mail OBEX object
and
pushes itoftosecurity
the server.
One of
the major drawbacks, however,
more.
is that you need to implement the Object Push Profile in your application code (which may be an
inconvenience for inexperienced developers). On the other hand, the Object Push Profile is already
defined
within the BlipNet API, so all you need to do is write the event handling code when your object
Table
of Contents
arrives
from
your Bluetooth-enabled clients.
Bluetooth for Java
Introduction
BlipNode
Installation
- Introducing Bluetooth
Chapter 1
Chapter
2 - of
Bluetooth
1.1 is pretty simple. All you need to do is supply the Ethernet connection and power.
Installation
a BlipNode
Chapter
3 - will
Before
You
Get Started
The device
then
register
itself to the BlipNet. Figure 11-3 is a picture of a single BlipNode unit.
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
11-3: A single BlipNode
List ofFigure
Sidebars
BlipManager Application
The BlipManager tool is used to configure and administer the BlipNet system. As shown in Figure 11-4, the
BlipManager gives you a visual representation of all the BlipNodes on your network.
Figure 11-4: The BlipManager application
Out of the box, the
BlipManager comes with the following features:
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Device filtering
ISBN:1590590783
Apress © 2003 (352 pages)
Security administration
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Node administration
Bluetooth-based services, highlights of security concerns, and
more. feature, you can block certain Bluetooth devices from using the BlipNet. You can
With the device filtering
create this filter based upon the client device's address or the device's class (i.e., laptop, cell phone,
headset), or based upon the available services on the device. The security administration feature allows
Table of Contents
you to assign PINs for individual nodes, or for the entire BlipNet. Using the node administration features of
Bluetooth for Java
the BlipManager, you can administer an individual node or create a group of nodes and administer them
Introduction
collectively. The node administration features also give you the ability to activate and deactivate the
Chapter 1 - Introducing Bluetooth
profiles on your nodes. Using this feature, it is very easy to configure multiple enterprise Bluetooth
Chapter
2 - Bluetooth
1.1 BlipNet network. For instance, in a grade school environment, all the BlipNodes
applications
on the same
Chapter
3 - Before
Youschool
Get Started
at the entrance
of the
can be configured to use only the Object Push Profile so that parents and
Chapter
Understanding
the Java
Bluetooth
API the school. However, in the teacher's lounge, the
visitors 4are- greeted
with some
information
about
Chapter
5 -can
Bluetooth
with J2ME
BlipNodes
be connected
to MIDP
the same network, but have only the LAN Access Profile activated so that
Chapter
6 can
- Creating
a Bluetooth
Print
Server with JPS API
teachers
get wireless
Internet
access.
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
for Java
BlipNet APIBluetooth
Overview
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
The BlipNet 1.1 API
consists
6 packages
and 40 classes and interfaces that allow you to create
Apress
© 2003of
(352
pages)
enterprise Bluetooth
applications.
Here's
a
list
of how
the BlipNet
packages:
The authors of this text describe
to develop
wireless Java
applications using Bluetooth for a variety of platforms. This
com.ericsson.blipnet.api.blipnode
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
com.ericsson.blipnet.api.blipserver
more.
com.ericsson.blipnet.api.bluetooth
Table of Contents
com.ericsson.blipnet.api.event
Bluetooth
for Java
Introduction
com.ericsson.blipnet.api.obex.pushobjects
Chapter 1
- Introducing Bluetooth
Chapter
2 - Bluetooth 1.1
com.ericsson.blipnet.api.util
Chapter 3
- Before You Get Started
Thecom.ericsson.blipnet.api.blipnode
Chapter
4 - Understanding the Java Bluetooth API package contains classes that deal directly with
individual BlipNodes,
like BlipNodeHandle. Conversely, the package
- Bluetooth with J2ME MIDP
com.ericsson.blipnet.api.blipserver contains classes that deal with the BlipServer such as
Chapter 6 - Creating a Bluetooth Print Server with JPS API
BlipServer and BlipServerConnection. If you are looking for classes that pertain to BluetoothChapter 7 - Java and OBEX
specific things like BluetoothAddress and ClassOfDevice, then they are found in the package
Chapter 8 - Using a Bluetooth Simulator
com.ericsson.blipnet.api.bluetooth.
Chapter 5
Chapter 9
- Bluetooth Security
Chapter
- Wireless
Embedded
Systems
the
BlueTargetcontained in the
Almost10
every
application
will use
one orwith
more
ofMicro
the interfaces
Chapter
com.ericsson.blipnet.api.event
11 - Enterprise Bluetooth Applications
package.
with the This
Ericsson
package
BlipNet
contains all the interfaces for listeners
and events
the and
BlipNet.
Chapter
12 - within
Bluetooth
Jini For instance, if you implement the BlipServerEventListener interface,
then youAcan
receive callbacks from the JVM when BlipNodeEvents,ConnectionEvents, and
Appendix
- javax.bluetooth
ObexEvents
are occurring. The com.ericsson.blipnet.api.event package also includes the
Appendix
B - javax.obex
ObexProgressListener
interface, which
you
can use
to determine the progress of an OBEX object
Appendix
C - Java Bluetooth Development
on the
PalmOS
Platform
transfer.D - BlipNet 1.1 API
Appendix
Index
When dealing with clients that support the Object Push Profile, the classes that form the
List
of Figures
com.ericsson.blipnet.api.obex.pushobjects
package come in handy. This package contains
List
of Tables
classes
such as ObexFile and ObexGenericObject that help you when you're sending or receiving
List
of Listings
OBEX
objects. For obvious reasons the com.ericsson.blipnet.api.util was designed to be a
List
of Sidebars
utility
package, but at the moment it only contains a single class for icons: BlipNetIcons.
CROSSREFERENCE
See Appendix D for a complete list (with descriptions) of all the classes and
interfaces of the BlipNet 1.1 API.
Now that you have a good understanding of the BlipNet architecture and its APIs, let's look at an example
demonstrating how to create an enterprise Bluetooth application using the Ericsson BlipNet.
Bluetooth
for Java
The Bluetooth
Device
Tracker
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
A Bluetooth device
tracker
is an
extremely
useful enterprise Bluetooth application, but it's really an invaluable tool
Apress
© 2003
(352
pages)
to anyone in the retail
business.
Why?
Have
you how
ever to
been
to a wireless
grocery Java
store where the peanut butter is in aisle
The authors of this text describe
develop
two, but the jelly is
located
in
aisle
twelve?
Or
even
worse,
the
coffee
and
applications using Bluetooth for a variety of platforms. This the cream are eight aisles apart.
includes an API overview of the Java library, development of
services,
highlights
security concerns,
In the near future,Bluetooth-based
almost every mobile
phone
will beofBluetooth
enabled, and
so a Bluetooth device tracker will help a
more.
grocery store manager to answer the following questions:
Are customers wandering around aimlessly?
Table of Contents
Bluetooth
for Java buying patterns exist?
Do consistent
Introduction
Which
the frequently
traveled aisles?
Chapter
1 - are
Introducing
Bluetooth
Chapter 2
- Bluetooth 1.1
Are the
aisles arranged properly?
Chapter 3
- Before You Get Started
Chapter
How
4 long
- Understanding
are customers
the in
Java
theBluetooth
store? API
Chapter 5
- Bluetooth with J2ME MIDP
All these factors
impact customer satisfaction and directly affect whether or not if the customer will return.
- Creating a Bluetooth Print Server with JPS API
Chapter 6
Chapter
7 - Java and
Tracking.java
is OBEX
a simple enterprise Bluetooth application that allows you to track Bluetooth devices using the
Chapter
8 BlipNet.
- Using a
Simulator
Ericsson
OfBluetooth
course, before
you run Tracking.java, you have to have at least two BlipNodes connected
Chapter
- Bluetooth
Security it would be pointless to track devices with only a single node). Another prerequisite is
to your 9BlipServer
(otherwise,
Chapter
10 - name
Wireless
with the Micro
that a user
andEmbedded
passwordSystems
to the BlipServer
mustBlueTarget
already be created. In this example, the user name is
Chapter
Tracking
11 - and
Enterprise
the password
Bluetooth
is Applications
Tracy. Youwith
alsothe
need
Ericsson
to assign
BlipNet
the BlipNodes that you want to perform device
tracking12to-aBluetooth
group. Inand
thisJini
example the group is called First_Floor.
Chapter
Appendix A - javax.bluetooth
Note Of course, you can create user names, passwords, and groups using the BlipManager application.
Appendix B - javax.obex
Appendix
Java
Bluetooth
Development
on the
PalmOS
Platform Bluetooth device), just execute the following
In order Cto-run
the
application
(and to track
every
discoverable
Appendix
D
BlipNet
1.1
API
statement, at the command line:
Index
List of Figures
java Tracking First_Floor
List of Tables
List of Listings
List
If you
of Sidebars
want to track specific Bluetooth clients, then you need to provide their Bluetooth address at the command
line, separated by spaces:
java Tracking First_Floor 001122334455 007e3ba4780f 0065ca98bd2e
This application starts off by calling the method initBlipServerConnection()in the constructor. In turn,
initBlipServerConnection() obtains a BlipServerConnection object by calling the static method
getConnection() from the BlipServer class. The parameters to this method include the user name and
password that you've created, as well as the hostname of the BlipServer:
BlipServer.getConnection("Tracking", "Tracy", "localhost");
Afterwards, a BlipServerEventFilter is created by calling the getEventFilter() method:
BlipServerEventFilter blipServerEventFilter =
getEventFilter(discoverBlipNodeGroup, terminalsToTrack);
Finally, we're going to add an event listener to the BlipServerConnectioninstance by calling its
addEventListener() method.
Bluetooth for Java
blipServerConnection.addEventListener(new
TrackingEventListener(),
ISBN:1590590783
by Bruce Hopkins and Ranjith Antony
blipServerEventFilter);
Apress © 2003 (352 pages)
The authors of this text describe how to develop wireless Java
applications using
Bluetooth
foraaBlipServerEventListener
variety of platforms. This
TheaddEventListener()
method
requires
and (optionally) a
includes an API
ofwe
thealready
Java library,
of a BlipServerEventFilter on
BlipServerEventFilter.
Atoverview
this point,
have development
an instance of
Bluetooth-based services, highlights of security concerns, and
hand, so we create
a new instance of our inner class TrackingEventListener.TrackingEventListener is
more.
a subclass of BlipServerEventAdapter, which, in turn, is an implementation of
BlipServerEventListener.
Table of Contents
When Bluetooth
Bluetooth
for Java devices are detected, the events are passed to the inner class, and the inner class then prints out
on the command line what's going on. The code for Tracking.java is shown in Listing 11-1.
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Listing 11-1: Tracking.java
package
Chapter
4 -com.ericsson.blipnet.samples;
Understanding the Java Bluetooth API
Chapter 5
import
import
Chapter 7
import
Chapter 8
import
Chapter 6
Chapter 9
- Bluetooth with J2ME MIDP
com.ericsson.blipnet.api.event.*;
- Creating a Bluetooth Print Server with JPS API
com.ericsson.blipnet.api.blipserver.*;
- Java and OBEX
com.ericsson.blipnet.api.bluetooth.BluetoothAddress;
- Using a Bluetooth Simulator
com.ericsson.blipnet.api.blipserver.BlipNode;
- Bluetooth Security
Chapter
10 java.util.Hashtable;
- Wireless Embedded Systems with the Micro BlueTarget
import
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter
12 class
- Bluetooth
and Jini {
public
Tracking
Appendix
A - javax.bluetooth
private
BlipServerConnection blipServerConnection;
Appendix
B - javax.obex
private
Hashtable terminalLastSeenOnThisBlipNode = new Hashtable();
Appendix C - Java Bluetooth Development on the PalmOS Platform
public
Tracking(String
discoverBlipNodeGroup,
Appendix
D - BlipNet
1.1 API
BluetoothAddress[] terminalsToTrack) {
Index
List of Figures
List of Tables// Get a connection to the server
initBlipServerConnection();
List of Listings
List of Sidebars
BlipServerEventFilter blipServerEventFilter =
getEventFilter(discoverBlipNodeGroup, terminalsToTrack);
try {
// Register the event Listener with the generated filter
blipServerConnection.addEventListener(new TrackingEventListener(),
blipServerEventFilter);
} catch (BlipServerConnectionException e) {
System.out.println("Error attaching listener");
e.printStackTrace();
System.exit(-1);
}
}
private void initBlipServerConnection() {
try {
blipServerConnection = BlipServer.getConnection("Tracking",
"Tracy", "localhost");
} catch (BlipServerConnectionException e) {
System.out.println("Error connecting to server");
e.printStackTrace();
Bluetooth for Java
System.exit(-1);
by Bruce
Hopkins and Ranjith Antony
} catch
(BlipServerAccessException
e)ISBN:1590590783
{
Apress
©
2003
(352
pages)
e.printStackTrace();
The authors of this text describe how registering
to develop wireless
Java- Have You created "+
System.out.println("Error
user
applications
using
Bluetooth
for
a
variety
of
platforms.
This
"a username/password for this application in BlipManager?");
includes an API overview of the Java library, development of
System.exit(-1);
Bluetooth-based services, highlights of security concerns, and
}
more.
}
Table of
Contents BlipServerEventFilter getEventFilter(String discoverBlipNodeGroup,
private
Bluetooth for Java
BluetoothAddress[] terminals) {
Introduction // List of BlipNodeIds used for tracking - is built from input
Chapter 1
Chapter 2
-//
Introducing
Bluetooth
in-line
parameters entered at start up of Tracking application.
-BluetoothAddress[]
Bluetooth 1.1
blipNodeAddressList = null;
Chapter 3
- Before You Get Started
Chapter 4
inquiryOnlyBlipNodes
= null;
-BlipNode[]
Understanding the
Java Bluetooth API
Chapter 5
{
-try
Bluetooth
with J2ME MIDP
Chapter 6
inquiryOnlyBlipNodes
= blipServerConnection.getBlipNodes
- Creating
a Bluetooth Print Server with
JPS API
Chapter 7
- Java and OBEX
Chapter 8
Chapter 9
Chapter 10
Chapter 11
(discoverBlipNodeGroup, "Discover Devices", false, false);
}
catch
(BlipServerConnectionException
e) {
- Using a Bluetooth Simulator
System.out.println("Could not get BlipNode handles "+
- Bluetooth Security
"for the BlipNode Group: "+ discoverBlipNodeGroup + "\n" + e);
- Wireless Embedded Systems with the Micro BlueTarget
System.exit(-1);
- Enterprise Bluetooth Applications with the Ericsson BlipNet
}
Chapter 12 - Bluetooth and Jini
Appendix A -//
javax.bluetooth
Are there any BlipNodes in the specified group ?
Appendix B -if
javax.obex
(inquiryOnlyBlipNodes.length > 1) {
Appendix C - Java blipNodeAddressList
Bluetooth Development on the
= PalmOS Platform
Appendix D - BlipNet 1.1 API new BluetoothAddress[inquiryOnlyBlipNodes.length];
Index
for (int i = 0; i < blipNodeAddressList.length; i++) {
blipNodeAddressList[i] =
inquiryOnlyBlipNodes[i].getBlipNodeID();
List of Tables
}
List of Listings
} else {
List of Sidebars
System.out.println("Have You inserted at least 2 BlipNodes " +
"in the group (" + discoverBlipNodeGroup + ") ?");
usage();
}
List of Figures
System.out.println("BlipNodes used for tracking (from group '"+
discoverBlipNodeGroup + "'):");
for (int i=0; i<blipNodeAddressList.length; i++) {
System.out.println("* "+
blipNodeAddressList[i].toString().toUpperCase());
}
if (null != terminals) {
System.out.println("\nTerminals being tracked: ");
for (int i=0; i<terminals.length; i++) {
System.out.println("* "+
terminals[i].toString().toUpperCase());
}
} else {
System.out.println("* Tracking all discoverable devices.");
}
System.out.println("-----------------\n");
Bluetooth for Java
ISBN:1590590783
by Bruce Hopkins and Ranjith Antony
Apress
©
2003
(352
pages)
return new BlipServerEventFilter(null,
}
The authors of this text describe how to develop
wireless
Java
new
int[]
{Event.TERMINAL_DETECTED},
applications using Bluetooth for a variety of platforms.
This
blipNodeAddressList, terminals);
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
private class TrackingEventListener extends BlipServerEventAdapter {
public void handleConnectionEvent(ConnectionEvent e) {
Table of Contents switch (e.getEventID()) {
Bluetooth for Java
case Event.TERMINAL_DETECTED:
Introduction
BluetoothAddress terminalID = e.getTerminalID();
Chapter 1 - Introducing Bluetooth
BluetoothAddress blipNodeID = e.getBlipNodeID();
Chapter 2 - Bluetooth 1.1
if (terminalLastSeenOnThisBlipNode.containsKey(terminalID)) {
Chapter 3 - Before You Get Started // Terminal has already been discovered before,
// so has
Chapter 4 - Understanding the Java Bluetooth
API it moved?
Chapter 5 - Bluetooth with J2ME MIDPif (!terminalLastSeenOnThisBlipNode.
get(terminalID).equals(blipNodeID)) {
Chapter 6 - Creating a Bluetooth Print Server with JPS API
System.out.println("Terminal: " + terminalID + " (" +
Chapter 7 - Java and OBEX
e.getTerminalFriendlyName() +
Chapter 8 - Using a Bluetooth Simulator
") moved from BlipNode: " +
Chapter 9 - Bluetooth Security
((BluetoothAddress) terminalLastSeenOnThisBlipNode.remove(terminalID)) +
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
" to BlipNode:" + blipNodeID);
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
terminalLastSeenOnThisBlipNode.put(terminalID,
Chapter 12 - Bluetooth and Jini
blipNodeID);
Appendix A - javax.bluetooth
} else {
Appendix B - javax.obex
// Terminal stays on the same BlipNode.
Appendix C - Java Bluetooth Development on
Platform
//the
DoPalmOS
not do
anything.
Appendix D - BlipNet 1.1 API
}
Index
} else {
List of Figures
// This is the first this terminal is seen on the system
System.out.println("Terminal: " + terminalID + " (" +
List of Tables
e.getTerminalFriendlyName() +
List of Listings
") discovered for the first time on" +
List of Sidebars
" BlipNode: " + blipNodeID);
terminalLastSeenOnThisBlipNode.put(terminalID,
blipNodeID);
}
break;
default:
System.out.println("Error - only TERMINAL_DETECTED " +
"events should be received! \nReceived " +
"event:" +
Event.FRIENDLY_NAMES[e.getEventID()]);
}
}
}
private static BluetoothAddress[] parseTerminalList(final String[] args) {
int numberOfTerminals = args.length - 1;
// List of BlipNodeIds used for tracking - is built from
// input in-line parameters entered at start up of Tracking application.
BluetoothAddress[] trackTheseTerminals = null;
if (numberOfTerminals > 0) {
Bluetooth for Java
trackTheseTerminals
= new BluetoothAddress[numberOfTerminals];
ISBN:1590590783
by Bruce
Hopkins
and Ranjith Antony
for
(int
inputParameterCount=0;
inputParameterCount
<
Apress © 2003 (352 pages)
numberOfTerminals; inputParameterCount++) {
The authors
try {of this text describe how to develop wireless Java
applications//
using
Bluetooth
platforms.
This
Make
sure for
ita variety
is a of
valid
TerminalID
(BluetoothAddress)
includes an API overview of the Java library, development of
trackTheseTerminals[inputParameterCount]
=
Bluetooth-based
services, highlights of security concerns, and
new BluetoothAddress(args[inputParameterCount+1]);
more.
} catch (IllegalArgumentException iae) {
System.out.println("TerminalId: " +
Table of Contents
args[inputParameterCount] +
Bluetooth for Java
" is invalid. A valid id, e.g. " +
Introduction
"112233445566\n" + iae);
Chapter 1 - Introducing Bluetooth
usage();
Chapter 2 - Bluetooth 1.1
}
} You Get Started
Chapter 3 - Before
Chapter 4 -}Understanding the Java Bluetooth API
Chapter 5 -return
BluetoothtrackTheseTerminals;
with J2ME MIDP
Chapter}6 - Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
private static void usage() {
Chapter 8 - Using a Bluetooth Simulator
System.out.println("The tracking application requires at least 2 " +
Chapter 9 - Bluetooth Security
"BlipNodes, please use BlipManager to specify the " +
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
"BlipNodeIds in the group.");
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
System.out.println("Specify the group name as first input parameter:");
Chapter 12 - Bluetooth and Jini
System.out.println("> Tracking MyGroup");
Appendix A - javax.bluetooth
System.out.println("Thereby the BlipNodes (specified in the " +
Appendix B - javax.obex
"BlipManager) in the group 'MyGroup' will be used. " +
Appendix C - Java Bluetooth Development on"These
the PalmOS
Platform must be");
BlipNodes
Appendix D - BlipNet
1.1
API
System.out.println("configured as 'Inquiry Only' BlipNodes. Use at " +
Index
"least two BlipNodes in the group.");
List of Figures System.out.println("When no Terminal Ids are specified all " +
"discoverable devices will be tracked.");
List of Tables
List of Listings System.out.println("-------------------");
List of SidebarsSystem.out.println("If only specific terminal is to be tracked, the " +
"Terminal Ids can be specified after the group " +
"name, e.g.:");
System.out.println("> Tracking MyGroup 001122334455 000102030405");
System.out.println("Thereby the same BlipNodes as above be used " +
"for tracking,");
System.out.println("and only the terminals with Ids 001122334455 " +
"000102030405 will be tracked (terminal list can " +
"be continued).");
System.out.println("-------------------");
System.out.println("In BlipManager a username/password pair must be " +
"defined for the Tracking-application. Under " +
"'BlipServer Properties',");
System.out.println("'Applications'; Create a new user with "+
"username/password: Tracking/Tracking.");
System.exit(-1);
}
public static void main(String[] args) {
// Must specify at least a BlipNode Group
if (args.length<1) {
usage();
}
Bluetooth for Java
ISBN:1590590783
by Bruce Hopkins andtrackTheseTerminals
Ranjith Antony
BluetoothAddress[]
= parseTerminalList(args);
Apress © 2003 (352 pages)
The authors of this text describe
how to Tracking
develop wireless
Java
System.out.println("**
Starting
application
**");
applications
using
Bluetooth
for
a
variety
of
platforms.
This
System.out.println("------------------");
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
Tracking
more. tracker = new Tracking(args[0], trackTheseTerminals);
System.out.println("Tracking application started");
Table of Contents
Bluetooth
} for Java
Introduction
Chapter
1
}
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Note
seea the
Tracker.java
example
theAPI
"examples" directory of the BlipNet SDK for a more detailed
Chapter
6 Please
- Creating
Bluetooth
Print Server
within
JPS
Chapter 7
code
explanation of the Tracker example.
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Summary
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
This chapter gaveApress
you an
introduction
© 2003
(352 pages)to the concept of enterprise Bluetooth applications. At this point, you
should understand
the
scenarios
where
enterprise
Bluetooth
applications
are best suited and the
The authors of this
text describe
how
to develop
wireless Java
components that applications
are neededusing
to create
them.
As
you
have
seen,
enterprise
Bluetooth for a variety of platforms. This Bluetooth applications cannot
an API overview
thean
Java
library, development of
be built with just aincludes
single Bluetooth
deviceofand
API.
Bluetooth-based services, highlights of security concerns, and
more.
Using the Ericsson
BlipNet, developers have the API, tools, and infrastructure in place in order to create
scalable and robust enterprise Bluetooth applications. In the final chapter of this book, we'll examine how
to network Bluetooth devices in a decentralized manner and create a Jini federations among Bluetooth
Table of Contents
devices.
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
for Java
Chapter Bluetooth
12: Bluetooth
and Jini
by Bruce Hopkins and Ranjith Antony
Overview
ISBN:1590590783
Apress © 2003 (352 pages)
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
Well, you've made
includes
it to the
anlast
APIchapter
overview
ofof
the
the
book.
Java By
library,
now,development
you should be
of fully aware of the capabilities of
Bluetooth-based
of security
concerns,
Bluetooth technology
with respectservices,
to Java.highlights
As we stated
in Chapter
4, theand
basics of any Bluetooth
more.
application consist of
Stack initialization
Table of Contents
Bluetooth
for management
Java
Device
Introduction
Device
discovery Bluetooth
Chapter
1 - Introducing
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Service discovery
Chapter
4 - Understanding
Service
registration the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Communication
Chapter
6 - Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 9
- Bluetooth Security
CROSSSeeChapter 4 for more details on the basics of a Bluetooth application.
Chapter 8 - Using a Bluetooth Simulator
REFERENCE
Chapter
Now perhaps
10 - Wireless
you've Embedded
heard of Jini
Systems
as well.
with
If you
the Micro
haven't
BlueTarget
used it before, then you should be at least aware
that it's11
a networking
Jini also happens
be a service-oriented
technology like Bluetooth (i.e.,
Chapter
- Enterprisetechnology.
Bluetooth Applications
with thetoEricsson
BlipNet
after you
the network,
you are able to consume or provide services).
Chapter
12join
- Bluetooth
and Jini
Appendix A - javax.bluetooth
So, if you want to know how to use Bluetooth and Jini together, then this is the chapter for you! Before we
go any further, let's first clearly define the following:
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix
D -isBlipNet
What
Jini? 1.1 API
Index
does Jini work?
List ofHow
Figures
List of Tables
After we answer those two questions, we can look at what it'll take to combine Jini and Bluetooth together.
We'll also look at a device that already integrates Bluetooth and Jini together: the PsiNaptic PsiNode.
List of Listings
List of Sidebars
for Java
What Is JiniBluetooth
Network
Technology?
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
Jini network technology
by Sun Microsystems to enable networked devices to communicate
Apress ©was
2003created
(352 pages)
and share services
with
little
or
no
human
intervention.
part, this
was inJava
response to their (correct)
The authors of this text describe
how to In
develop
wireless
perception that the
rapidly
increasing
complexity
of
the
network
environment
would cause current
applications using Bluetooth for a variety of platforms. This
includes
an API overview
of the Java library,
of following problems with
practices in network
management
to fail completely.
Jini setdevelopment
out to solve the
Bluetooth-based services, highlights of security concerns, and
distributed computing:
more.
Networks are unreliable. Connections to other computers may disappear unexpectedly.
Table of Contents
The latency of a network is variable. Delays in sending and receiving information are dependent on
Bluetooth
for such
Java as the physical medium, traffic on the network, and information routing algorithms.
factors
Introduction
Bandwidth
is not constant.
Like latency, there is often no guarantee of transmission capacity.
Chapter
1 - Introducing
Bluetooth
Chapter 2
- Bluetooth 1.1
Networks are insecure. This is especially true of heterogeneous networks where the devices
- Before You Get Started
exchanging information cannot control the path that the information takes.
Chapter 3
Chapter 4
- Understanding the Java Bluetooth API
Chapter
5 - Bluetooth
with
J2ME
MIDP This is most obvious in mobile networks when devices move between
Network
topologies
are
variable.
Chapter
6
Creating
a
Bluetooth
with future,
JPS APImultimode devices will move between network
network access points. NowPrint
and Server
in the near
Chapter
7 -(e.g.,
Java from
and OBEX
types
a cellular network to a wireless local area network to a wired desktop network).
Chapter 8 - Using a Bluetooth Simulator
Administration
of Security
networks is not uniform. Multiple networks provide their own sets of rules, protocols,
Chapter
9 - Bluetooth
access, authorization, and security protocols, all controlled by different organizations and individuals.
Accessing and securing resources across these networks will be complicated because of inconsistent
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
administration practices.
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 12 - Bluetooth and Jini
Appendix
A - javax.bluetooth
Access
and transportation costs are variable.
Appendix B - javax.obex
Many
devicesDevelopment
with differentonconfigurations,
capabilities, and operating systems will participate
Appendix
C -different
Java Bluetooth
the PalmOS Platform
in the
Appendix
D -network.
BlipNet 1.1 API
Index
Jini federations are agnostic to the type of connection between the devices participating in the network. It
doesn't matter if the participants are connected physically or wirelessly; the only requirement is that the
List
of Tables are TCP/IP based.
connections
List of Figures
List of Listings
Jini also supports members in a federation with non-TCP/IP-based connections through
List ofNote
Sidebars
surrogates.
The functionality of members in a Jini federation can be summarized in six mechanisms:
Lookup
Discovery
Join
Leasing
Transactions
Events
Lookup
Lookup is a Jini service that acts much like a directory. For instance, if a printer wants to provide printer
services to a Jini federation, then it must register that service with a Lookup Service. Conversely, if you are
participating in a Jini federation, and you want to print, you must check the Lookup Service to see if any
printer services are available.
for Java
Note As you Bluetooth
can see, finding
services in Jini has a centralized approach by going through a Lookup
ISBN:1590590783
Bruce Hopkins
Ranjith Antony
Service.byBluetooth
has aand
decentralized
approach to finding
services since you need to perform a
© 2003
(352in
pages)
search Apress
on each
device
your piconet to find what services are available.
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
The process of finding
more. a suitable Lookup Service in a Jini federation is referred to as discovery.
Discovery
Note The concept of discovery in Jini is radically different compared to that in Bluetooth. In Jini,
Table of Contents
discovery is simply finding a Lookup Service. In Bluetooth, discovery allows you to find Bluetooth
Bluetooth for
devices
Java as well as the services that they offer.
Introduction
Join
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter
Once a3Lookup
- Before
Service
You Get
has
Started
been found, a service may join that Lookup Service by providing one or more
Java objects.
The Join protocol
defines
the mechanism
to accomplish this.
Chapter
4 - Understanding
the Java
Bluetooth
API
Chapter 5
- Bluetooth with J2ME MIDP
- Creating a Bluetooth Print Server with JPS API
Leasing
Chapter 6
Chapter 7
- Java and OBEX
The use
resource
in a Jini
federation is granted for a specific amount of time. This concept is known
Chapter
8 of- aUsing
a Bluetooth
Simulator
as
a
lease.
The
duration
of
the
Chapter 9 - Bluetooth Security lease may be fixed by the grantor or negotiated. To maintain the use of a
service10
(including
services
joined
to Lookup
the lease must be renewed periodically. This allows
Chapter
- Wireless
Embedded
Systems
with Services),
the Micro BlueTarget
for
the
expiration
and
cleanup
of
services
that
are
no
longer
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson required,
BlipNet or whose owners have left the
federation.
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Transactions
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Atransaction
allows1.1
a set
Appendix
D - BlipNet
APIof operations to be grouped in such a way that they either all succeed or all fail.
To the members of the federation, the group of operations in the transaction appear to function as a single
unit.
Index
List of Figures
List of Tables
Events
List of Listings
List of Sidebars
An object residing on a device may register an interest in an event occurring in another object residing on
a different device in the federation and receive notification when the event occurs. Thus, events provide a
mechanism for maintaining consistency of state information in the federation.
Bluetooth for Java
How Jini Works
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
So, let's first define
a Jini© ServiceItem.
A ServiceItem is comprised of a service object and some
Apress
2003 (352 pages)
attributes. The only
real
restriction
on
ServiceItem
objects
is wireless
that theyJava
be serializable.
The authors of this text describe how to
develop
applications using Bluetooth for a variety of platforms. This
There are typically
three entities
involved of
in athe
Jini
federation:
includes
an API overview
Java
library, development of
Bluetooth-based services, highlights of security concerns, and
Service Providers
more. are the entities that provide a Java-based software service. The service can be
pretty much anything and doesn't necessarily have anything to do with the device that hosts the
provider. For instance, a Jini-enabled printer can provide a printer service in a Jini federation, but
Table of Contents
there's nothing stopping it from providing a random number generator service to the federation as
Bluetooth
well.for Java
Introduction
Service
ConsumersBluetooth
are clearly the entities that have an interest in using the services that are available
Chapter
1 - Introducing
in the
federation.
Chapter
2 -Jini
Bluetooth
1.1
Chapter 3
- Before You Get Started
Lookup Services (LUS) are the Jini services that act on behalf of Service Providers to host their
- Understanding the Java Bluetooth API
services. This is also the "directory" that Service Consumers use in order to find services in the
Chapter 5 - Bluetooth with J2ME MIDP
federation.
Chapter 4
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter
Java and OBEX
Before 7the-federation
is formed, these entities must exist (see Figure 12-1).
Chapter 8 - Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List ofFigure
Listings12-1: These three entities must exist before a Jini federation is established. The federation
List ofitself
Sidebars
hasn't been formed because the entities don't know anything about each other yet.
Discovering a Lookup Service
In order to get the ball rolling, the clients (Service Providers or Service Consumers) must discover a
Lookup Service.
Note A Jini federation can have more than one Lookup Service.
Jini defines three discovery mechanisms:
Multicast announcement from a Lookup Service
Multicast request from a client
Unicast request from a client
A Lookup Service can use multicast announcements periodically to advertise its presence on the network.
Interested clients, Service Providers or Service Consumers in particular, can use the information provided
in an announcement to communicate with the Lookup Service.
Clients use multicast requests to discover a Lookup Service. A Lookup Service receiving a request
responds directly to that client. Once the address of a Lookup Service is known, a client sends a unicast
request directly to the Lookup Service.
Bluetooth for Java
Hopkins and
Ranjith Antony
The LifecyclebyofBruce
a Service
Provider
ISBN:1590590783
Apress © 2003 (352 pages)
Now, let's assume
that
a Lookup
Service
is making
multicast
announcements.
A Service Provider
The
authors
of this
text describe
howperiodic
to develop
wireless
Java
applications
Bluetooth
variety of
platforms.
This
hears an announcement,
andusing
receives
from for
theaLookup
Service
its ServiceRegistrar.
A
includes
API overview
of is
the
Java library,
development
of the Lookup Service. It allows a
ServiceRegistrar
is aanJava
object that
simply
the public
interface to
Bluetooth-based services, highlights of security concerns, and
client to register services,
look up services, and request notification of changes in the Lookup Service. This
more.
interaction is shown in Figure 12-2.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter
9 - 12-2:
Bluetooth
Figure
TheSecurity
Service Provider discovers the Lookup Service and receives its
Chapter
10
Wireless
Embedded
Systems
with the Micro BlueTarget
ServiceRegistrar
object.
The ServiceRegistrar
is used to interact with the Lookup Service
Chapter
11
Enterprise
Bluetooth
Applications
with the Ericsson BlipNet
via its public methods.
Chapter 12 - Bluetooth and Jini
In the final
of the discovery process, the Service Provider receives the ServiceRegistrar object,
Appendix
A -step
javax.bluetooth
which it can
use to register its ServiceItem with the Lookup Service.
Appendix
B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Leasing a ServiceItem and Joining a Federation
Appendix D - BlipNet 1.1 API
Index
When a Service Provider registers its ServiceItem as shown in Figure 12-3, it also specifies a lease
List
of Figures
duration
for the service. If the registration is successful, the Lookup Service will keep the service registered
List
for of
atTables
least that length of the lease requested, or provide a duration of its own. It's up to the Service
Provider
to renew the lease as required. After the ServiceItem is registered with the Lookup Service, the
List
of Listings
Service
Provider has joined the federation.
List
of Sidebars
Figure 12-3: The Service Provider registers its ServiceItem with the Lookup Service.
Note The leasing mechanism is an important part of Jini technology because it allows devices to
clean up unused resources. If a lease expires (or if it can't be renewed because the lease
grantor or holder has left the federation), the associated resource can be released.
Now that we have a federation with a Service Provider in it, it's time to look at things from the Service
Consumer's perspective.
The LifecycleBluetooth
of a Service
Consumer
for Java
by Bruce
Hopkins
Ranjith
The Service Consumer
also
starts and
its life
cycleAntony
by discovering aISBN:1590590783
Lookup Service. It uses the same
Apress
©
2003
(352
pages)
discovery mechanisms that a Service Provider uses. The Service Consumer can use any of the three
The authors
thisscenario,
text describe
to develop
wireless
Java
discovery mechanisms,
but inofthis
let's how
say that
the Service
Consumer
is using a multicast
applications using Bluetooth for a variety of platforms. This
request to find a Lookup Service. This is illustrated in Figure 12-4.
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Figure
TheOBEX
Lookup Service receives a multicast request from the Service Consumer and
Chapter
7 - 12-4:
Java and
responds
with a unicast message containing the ServiceRegistrar object.
- Using a Bluetooth Simulator
Chapter 8
Chapter 9
- Bluetooth Security
The Service
Consumer device makes a number of periodic multicast requests. When a Lookup Service
Chapter
10a-request,
Wireless itEmbedded
with the
Micro BlueTarget
receives
responds Systems
with a simple
message
that contains its ServiceRegistrar object. At
Chapter
11
Enterprise
Bluetooth
Applications
with
the Ericsson BlipNet
this point the Service Consumer is part of the federation.
Chapter 12 - Bluetooth and Jini
With theAServiceRegistrar
in hand, the Service Consumer can use its lookupmethods to look for
Appendix
- javax.bluetooth
useful services.
Appendix
B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Thelookup methods of the ServiceRegistrar object require a ServiceTemplate object as an
argument. This template may contain nothing more than an array of class types. It's that simple! You get
Index
back either the service object itself, or a special object (ServiceMatches) containing all the services that
List
of Figures
matched
your template. This process is illustrated in Figures 12-5 and 12-6.
Appendix D - BlipNet 1.1 API
List of Tables
List of Listings
List of Sidebars
Figure 12-5: The Service Consumer uses the local ServiceRegistrar object to look up services that
are registered in the Lookup Service.
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
Table of Contents
Bluetooth for Java
Figure 12-6: The ServiceItem requested is returned to the Service Consumer and can be used
locally.
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Note
to understanding how the Service Consumer gets a service, it's useful to
Chapter
3 Though
- Before not
Youcrucial
Get Started
that a requested
service
is marshalled
on the Lookup Service before being passed to the
Chapter 4 know
- Understanding
the Java
Bluetooth
API
Consumer.
Basically,
the service object is flattened and serialized, and then served as a
Chapter 5 Service
- Bluetooth
with J2ME
MIDP
to the Service
Consumer.
Oncewith
received,
Chapter 6 file
- Creating
a Bluetooth
Print Server
JPS APIthe Service Consumer's JVM unmarshalls the
Chapter 7
object
into an instantiation of the service object.
- Java and OBEX
Chapter
8 Service
- Using aConsumer
Bluetooth has
Simulator
Once the
the desired ServiceItem, it can use the service locally. "Under the
Chapter
9
Bluetooth
Security
covers" the service may communicate back to the Service Provider as shown in Figure 12-7.
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Figure 12-7: Once activated on the Service Consumer, the Service Provider's service may
communicate directly with the Service Provider device as part of the service offered.
for Bluetooth
Java
IntegratingBluetooth
Jini and
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
Now that you have
a clear
understanding
of the basics of a Jini federation, let's examine the possible
Apress
© 2003
(352 pages)
scenarios of what's
involved
when
integrating
Jinihow
andtoBluetooth
together.
The authors of this text describe
develop wireless
Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
All-Bluetooth Jini Federation
As the name implies, in an all-Bluetooth Jini federation, all the devices participating in the federation are
Bluetooth enabled. For such a scenario to take place, the Bluetooth devices must discover each other and
Table
formof
a Contents
piconet. Since a requirement of a Jini federation is that the connections between the devices be
Bluetooth
for Javathe Bluetooth devices in an all-Bluetooth Jini federation would be connecting with either of
TCP/IP based,
Introduction
the following TCP/IP-based Bluetooth profiles:
Chapter 1
- Introducing Bluetooth
Dial-Up Networking Profile
Chapter 2 - Bluetooth 1.1
Chapter
3 Access
- BeforeProfile
You Get Started
LAN
Chapter 4
- Understanding the Java Bluetooth API
Personal
Area Networking
Chapter
5 - Bluetooth
with J2ME Profile
MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Note Invariably, a manufacturer could make an all-Bluetooth Jini device without providing any of the
- Java and OBEX
preceding Bluetooth profiles in its product. For instance, the manufacturer can satisfy the TCP/IP
Chapter 8 - Using a Bluetooth Simulator
requirement by simply implementing the BNEP protocol. The major drawback, however, is that
Chapter 9 - Bluetooth Security
those devices will be totally incompatible with devices from other manufacturers.
Chapter 7
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter
11piconet
- Enterprise
Bluetooth
Applications
withIPthe
Ericsson BlipNet
After the
has been
established
and the
addresses
have been assigned, the Jini federation can
Chapter
be formed.
12 - At
Bluetooth
this point,
andthis
Jinifederation is just like any other Jini federation. If other Bluetooth devices want
to join the
they must first join the piconet, obtain an IP, and then join the Jini federation. Since
Appendix
A -federation,
javax.bluetooth
the IP network
is running over Bluetooth, this federation is wireless. An example of an all-Bluetooth Jini
Appendix
B - javax.obex
federation
shown
in Figure
12-8.
Appendix
C -isJava
Bluetooth
Development
on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Figure 12-8: In an all-Bluetooth Jini federation, all the devices participating in the federation must be
Bluetooth enabled. This federation is wireless.
Hybrid Bluetooth Jini Federation
In a hybrid Bluetooth Jini federation, one or more devices are Bluetooth enabled. Note however that all the
devices are physically connected by traditional TCP/IP connections, and the federation is not wireless
(unless the TCP/IP network is WLAN). There are no special precautions that need to be taken care of, so
this federation is formed in the usual manner. Any of the devices in the federation can be Bluetooth
enabled, but it makes sense that either the Service Provider or the Service Consumer have Bluetooth
capability so it can act as a bridge between the Jini federation and an outside Bluetooth piconet elsewhere.
A hybrid Bluetooth Jini federation is shown in Figure 12-9.
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter
4 - 12-9:
Understanding
theBluetooth
Java Bluetooth
API
Figure
In a hybrid
Jini federation,
at least one of the devices participating in the
Chapter
5
Bluetooth
with
J2ME
MIDP
federation must be Bluetooth enabled. This federation is not (necessarily) wireless, and the JiniChapter
6 - Creating a Bluetooth
Print
withbetween
JPS API the Jini federation and an external Bluetooth
Bluetooth-enabled
device acts
asServer
a bridge
Chapter
7
Java
and
OBEX
piconet.
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
A Jini-Bluetooth-Enabled
Device: The PsiNaptic PsiNode
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
Dallas Semiconductor
a product
line of sensors that can be connected to a two-wire bus (power and
Apresshas
© 2003
(352 pages)
ground) called 1-Wire.
They
have
a
Java
development
and reference
design called Tiny Internet
The authors of this text describe
how to platform
develop wireless
Java
Interface (TINI) that
includes
a
1-Wire
interface.
PsiNaptic
Inc.
has
combined
the
TINI chipset with an
applications using Bluetooth for a variety of platforms. This
includes
anin
API
overview of
the Java
library,that
development
Ericsson Bluetooth
module
a reference
design
platform
they have of
named, PsiNode. The PsiNode
Bluetooth-based
highlights
of host
security
andsolution for creating a low-cost,
platform is capable
of acting as aservices,
Jini Lookup
Service
andconcerns,
is a perfect
more.
small-footprint, remote 1-Wire sensor/controller. A picture of the PsiNode is shown in Figure 12-10.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 9
- Bluetooth Security
Figure 12-10: The PsiNode development platform. The Ericsson Bluetooth module is covered by two
Chapter 8 - Using a Bluetooth Simulator
metal plates, and is connected to the Dallas Semiconductor TINI microcontroller.
Chapter
10 Any
- Wireless
Embedded
Systems
the Micro BlueTarget TINI) can function as a Jini Lookup
Note
ordinary
TINI device
(i.e., with
a non-Bluetooth-enabled
Chapter 11 Service
- Enterprise
Applications
withalso
the makes
Ericssonsoftware
BlipNet for this purpose (called JMatos), and
in a Bluetooth
Jini federation.
PsiNaptic
Chapter 12 you
- Bluetooth
can getand
it from
Jini their Web site (http://www.psinaptic.com).
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth
for Java
The Benefits
of Bluetooth
and Jini
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
So what are the advantages
integrating
Bluetooth and Jini into devices? In the case of mobile devices,
Apress © 2003of(352
pages)
an all-Bluetooth Jini
federation
allows
devices
to how
formto"smarter"
networks.
A Jini federation allows
The authors of this text describe
develop wireless
Java
Bluetooth devicesapplications
to interoperate
with
more
flexibility,
without
being
constrained
by the limits of Bluetooth
using Bluetooth for a variety of platforms. This
includes an
ofbrings
the Java
development
of of events, transactions, and
profiles. More importantly,
a API
Jini overview
federation
to library,
the table
the concepts
Bluetooth-based
services, highlights
of security
concerns,
and
leasing, which allows
for more fault-tolerant
and robust
Bluetooth
applications.
more.
In a hybrid Bluetooth Jini federation, Bluetooth devices that are not capable of joining the federation and
using its services can interact with the bridge device and consume the services of the federation.
Table of Contents
Conversely, the bridge device can provide wireless services to the Jini federation by interacting with an
Bluetooth for Java
external Bluetooth piconet.
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Summary
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
In this chapter, we
gave ©you
overview
Apress
2003an
(352
pages) of the principles and concepts of Jini network technology. We
also presented anThe
overview
of
the
and "whys"
fordevelop
integrating
Bluetooth
authors of this"hows"
text describe
how to
wireless
Java and Jini together in order to
create some really
cool
wireless
applications.
Both
Jini
and
Bluetooth
complement
each other for creating
applications using Bluetooth for a variety of platforms. This
includesJini
an brings
API overview
of theadvanced
Java library,
development
of
networked applications.
to the table
networking
capabilities
such as leasing and
Bluetooth-based
highlights
of security
concerns,
distributed events,
while Bluetoothservices,
allows the
members
of the network
toand
be small, power efficient, and
more.
wireless.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
for Java
AppendixBluetooth
A: javax.bluetooth
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
Apress all
© 2003
pages)
This appendix contains
the (352
fields
and method signatures of the classes, interfaces, and exceptions that
The
authors
of
this
text describe
how
to develop
comprise the javax.bluetooth package
of the
JSR-82
API. wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
Class BluetoothConnectionException
// fields
Table
static
of Contents
int FAILED_NOINFO
static for
int
Bluetooth
JavaNO_RESOURCES
static int SECURITY_BLOCK
Introduction
static
TIMEOUT
Chapter
1 int
- Introducing
Bluetooth
static
UNACCEPTABLE_PARAMS
Chapter
2 int
- Bluetooth
1.1
static
UNKNOWN_PSM
Chapter
3 int
- Before
You Get Started
Chapter 4
- Understanding the Java Bluetooth API
// constructors
- Bluetooth with J2ME MIDP
BluetoothConnectionException(int error)
Chapter 6 - Creating a Bluetooth Print Server with JPS API
BluetoothConnectionException(int error, java.lang.String msg)
Chapter 5
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
// methods
Chapter
9 - Bluetooth Security
int getStatus()
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
Class BluetoothStateException
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
// constructors
The authors of this text describe how to develop wireless Java
BluetoothStateException()
applications using Bluetooth for a variety of platforms. This
BluetoothStateException(java.lang.String
msg)
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
Class DataElement
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
// fields
The authors of this text describe how to develop wireless Java
static int BOOL
applications using Bluetooth for a variety of platforms. This
static int DATALT
includes an API overview of the Java library, development of
static int DATSEQ
Bluetooth-based services, highlights of security concerns, and
static int INT_1
more.
static int INT_16
static int INT_2
Table of Contents
static int INT_4
Bluetooth
JavaINT_8
static for
int
Introduction
static int NULL
Chapter
1 int
- Introducing
static
STRINGBluetooth
Chapter
2 int
- Bluetooth
1.1
static
U_INT_1
Chapter
3 int
- Before
You Get Started
static
U_INT_16
Chapter
static
4 int
- Understanding
U_INT_2 the Java Bluetooth API
static
U_INT_4
Chapter
5 int
- Bluetooth
with J2ME MIDP
static
U_INT_8
Chapter
6 int
- Creating
a Bluetooth Print Server with JPS API
static
Chapter
7 int
- JavaURL
and OBEX
static
int
UUID
Chapter 8 - Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
// constructors
DataElement(boolean bool)
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
DataElement(int valueType)
Chapter 12 - Bluetooth and Jini
DataElement(int valueType, long value)
Appendix A - javax.bluetooth
DataElement(int valueType, java.lang.Object value)
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Appendix B - javax.obex
Appendix
C - Java Bluetooth Development on the PalmOS Platform
// methods
Appendix
D - BlipNet 1.1 API
void addElement(DataElement
elem)
Index
boolean getBoolean()
List
of Figures
int
getDataType()
List
of Tables
long
getLong()
List
int
of Listings
getSize()
java.lang.Object
getValue()
List
of Sidebars
void insertElementAt(DataElement elem, int index)
boolean removeElement(DataElement elem)
Bluetooth for Java
Class DeviceClass
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
// constructors
The authors
of this text describe how to develop wireless Java
DeviceClass(int
record)
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
// methods Bluetooth-based services, highlights of security concerns, and
int getMajorDeviceClass()
more.
int getMinorDeviceClass()
int getServiceClasses()
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
Class DiscoveryAgent
// fields
static int
static int
static int
static int
static int
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
CACHED
applications using Bluetooth for a variety of platforms. This
GIAC
includes an API overview of the Java library, development of
LIAC
Bluetooth-based services, highlights of security concerns, and
NOT_DISCOVERABLE
more.
PREKNOWN
Table of Contents
// methods
Bluetooth
forcancelInquiry(DiscoveryListener
Java
boolean
listener)
Introduction
boolean cancelServiceSearch(int transID)
Chapter
1 - Introducing
Bluetooth
RemoteDevice[]
retrieveDevices(int
option)
Chapter
2 - Bluetooth 1.1
int searchServices(int[]
attrSet, UUID[] uuidSet, RemoteDevice btDev,
Chapter 3 - Before You Get Started
DiscoveryListener discListener)
Chapter
java.lang.String
4 - Understanding
selectService(UUID
the Java Bluetooth API uuid, int security, boolean master)
boolean
accessCode, DiscoveryListener listener)
Chapter
5 -startInquiry(int
Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
Interface DiscoveryListener
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
// fields
The authors of this text describe how to develop wireless Java
static int INQUIRY_COMPLETED
applications using Bluetooth for a variety of platforms. This
static int INQUIRY_ERROR
includes an API overview of the Java library, development of
static int INQUIRY_TERMINATED
Bluetooth-based services, highlights of security concerns, and
static int SERVICE_SEARCH_COMPLETED
more.
static int SERVICE_SEARCH_DEVICE_NOT_REACHABLE
static int SERVICE_SEARCH_ERROR
Table of Contents
static int SERVICE_SEARCH_NO_RECORDS
Bluetooth
JavaSERVICE_SEARCH_TERMINATED
static for
int
Introduction
// methods
Chapter
1 - Introducing Bluetooth
void deviceDiscovered(RemoteDevice
btDevice, DeviceClass cod)
Chapter
2 - Bluetooth 1.1
void inquiryCompleted(int
discType)
Chapter
3 - Before You Get Started
void servicesDiscovered(int
transID, ServiceRecord[] servRecord)
Chapter
void serviceSearchCompleted(int
4 - Understanding the Java Bluetooth transID,
API
int respCode)
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
Interface L2CAPConnection
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
// fields
The authors of this text describe how to develop wireless Java
static int DEFAULT_MTU
applications using Bluetooth for a variety of platforms. This
static int MINIMUM_MTU
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
// methods more.
int getReceiveMTU()
int getTransmitMTU()
Table of Contents
boolean ready()
Bluetooth
for Java
int receive(byte[]
inBuf)
Introduction
void send(byte[] data)
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
Interface L2CAPConnectionNotifier
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
// method
The authors
of this text describe how to develop wireless Java
L2CAPConnection
acceptAndOpen()
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
Class LocalDevice
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
// methods
The authors
of this text describe how to develop wireless Java
java.lang.String
getBluetoothAddress()
applications using Bluetooth for a variety of platforms. This
DeviceClass getDeviceClass()
includes an API overview of the Java library, development of
int getDiscoverable()
Bluetooth-based services, highlights of security concerns, and
DiscoveryAgent
more.
getDiscoveryAgent()
java.lang.String getFriendlyName()
static LocalDevice getLocalDevice()
Table of Contents
static java.lang.String getProperty(java.lang.String property)
Bluetooth
for Java
ServiceRecord
getRecord(javax.microedition.io.Connection notifier)
Introduction
boolean setDiscoverable(int mode)
Chapter
1 - Introducing Bluetooth
void updateRecord(ServiceRecord
srvRecord)
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
Class RemoteDevice
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
// constructor
The authors of this text describe how to address)
develop wireless Java
protected RemoteDevice(java.lang.String
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
// methods Bluetooth-based services, highlights of security concerns, and
boolean authenticate()
more.
boolean authorize(javax.microedition.io.Connection conn)
boolean encrypt(javax.microedition.io.Connection conn, boolean on)
Table of Contents
boolean equals(java.lang.Object obj)
Bluetooth
for Java
java.lang.String
getBluetoothAddress()
Introduction
java.lang.String getFriendlyName(boolean alwaysAsk)
Chapter
1 RemoteDevice
- Introducing Bluetooth
static
getRemoteDevice(javax.microedition.io.Connection conn)
Chapter
2 - Bluetooth 1.1
int hashCode()
Chapter
3 -isAuthenticated()
Before You Get Started
boolean
Chapter
boolean
4 -isAuthorized(javax.microedition.io.Connection
Understanding the Java Bluetooth API
conn)
boolean
Chapter
5 -isTrustedDevice()
Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
Interface ServiceRecord
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
// fields
The authors of this text describe how to develop wireless Java
static int AUTHENTICATE_ENCRYPT
applications using Bluetooth for a variety of platforms. This
static int AUTHENTICATE_NOENCRYPT
includes an API overview of the Java library, development of
static int NOAUTHENTICATE_NOENCRYPT
Bluetooth-based services, highlights of security concerns, and
more.
// methods
int[] getAttributeIDs()
Table of Contents
DataElement getAttributeValue(int attrID)
Bluetooth
for Java
java.lang.String
getConnectionURL(int requiredSecurity, boolean mustBeMaster)
Introduction
RemoteDevice getHostDevice()
Chapter
1 -populateRecord(int[]
Introducing Bluetooth
boolean
attrIDs)
Chapter
2 -setAttributeValue(int
Bluetooth 1.1
boolean
attrID, DataElement attrValue)
Chapter
3 - Before You Get Started
void setDeviceServiceClasses(int
classes)
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
Class ServiceRegistrationException
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
// constructors
The authors of this text describe how to develop wireless Java
ServiceRegistrationException()
applications using Bluetooth for a variety of platforms. This
ServiceRegistrationException(java.lang.String
msg)
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Class UUIDBluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
// constructors
The authors of this text describe how to develop wireless Java
UUID(long uuidValue)
applications using Bluetooth for a variety of platforms. This
UUID(java.lang.String
uuidValue, boolean shortUUID)
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
// methods more.
boolean equals(java.lang.Object value)
int hashCode()
Table of Contents
java.lang.String toString()
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
for Java
AppendixBluetooth
B: javax.obex
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
Apress all
© 2003
pages)
This appendix contains
the (352
fields
and method signatures of the classes, interfaces, and exceptions that
The
authors
of
this
howAPI.
to develop wireless Java
comprise the javax.obex packagetext
of describe
the JSR-82
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
Interface Authenticator
// methods
Table
PasswordAuthentication
of Contents
onAuthenticationChallenge(java.lang.String description,
Bluetooth for Java
boolean isUserIdRequired, boolean isFullAccess)
byte[] onAuthenticationResponse(byte[] userName)
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
Interface ClientSession
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
// methods
The authors of this textheaders)
describe how to develop wireless Java
HeaderSet connect(HeaderSet
applications using Bluetooth for a variety of platforms. This
HeaderSet createHeaderSet()
includes an API overview of the Java library, development of
HeaderSet delete(HeaderSet
headers)
Bluetooth-based services,
highlights of security concerns, and
HeaderSet disconnect(HeaderSet
more.
headers)
Operation get(HeaderSet headers)
long getConnectionID()
Table of Contents
Operation put(HeaderSet headers)
Bluetooth
for Java
void setAuthenticator(Authenticator
auth)
Introduction
void setConnectionID(long id)
Chapter
1 - Introducing
Bluetooth
HeaderSet
setPath(HeaderSet
headers, boolean backup, boolean create)
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
Interface HeaderSet
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
// fields
The authors of this text describe how to develop wireless Java
static int APPLICATION_PARAMETER
applications using Bluetooth for a variety of platforms. This
static int COUNT
includes an API overview of the Java library, development of
static int DESCRIPTION
Bluetooth-based services, highlights of security concerns, and
static int HTTP
more.
static int LENGTH
static int NAME
Table of Contents
static int OBJECT_CLASS
Bluetooth
JavaTARGET
static for
int
Introduction
static int TIME_4_BYTE
Chapter
1 int
- Introducing
Bluetooth
static
TIME_ISO_8601
Chapter
2 int
- Bluetooth
static
TYPE 1.1
Chapter
3 int
- Before
static
WHOYou Get Started
Chapter 4
- Understanding the Java Bluetooth API
// methods
Chapter
5 - Bluetooth with J2ME MIDP
void createAuthenticationChallenge(java.lang.String
realm, boolean userID,
Chapter
6 - Creating a Bluetooth Print Server with JPS API
boolean access)
- Java and OBEX
java.lang.Object
getHeader(int
headerID)
Chapter 8 - Using a Bluetooth Simulator
int[]9 getHeaderList()
Chapter
- Bluetooth Security
int getResponseCode()
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
void setHeader(int headerID, java.lang.Object headerValue)
Chapter 7
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
Interface Operation
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
// methods
void abort() The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
HeaderSet getReceivedHeaders()
includes an API overview of the Java library, development of
int getResponseCode()
Bluetooth-based services, highlights of security concerns, and
int getResponseCode()
more.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
Class PasswordAuthentication
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
// constructor
The authors of this text describe
how to byte[]
develop wireless
Java
PasswordAuthentication(byte[]
userName,
password)
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
// methods Bluetooth-based services, highlights of security concerns, and
byte[] getPassword()
more.
byte[] getUserName()
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
Class ResponseCodes
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
// fields
The authors of this text describe how to develop wireless Java
static int OBEX_DATABASE_FULL
applications using Bluetooth for a variety of platforms. This
static int OBEX_DATABASE_LOCKED
includes an API overview of the Java library, development of
static int OBEX_HTTP_ACCEPTED
Bluetooth-based services, highlights of security concerns, and
static int OBEX_HTTP_BAD_GATEWAY
more.
static int OBEX_HTTP_BAD_METHOD
static int OBEX_HTTP_BAD_REQUEST
Table of Contents
static int OBEX_HTTP_CONFLICT
Bluetooth
JavaOBEX_HTTP_CREATED
static for
int
Introduction
static int OBEX_HTTP_ENTITY_TOO_LARGE
Chapter
1 int
- Introducing
Bluetooth
static
OBEX_HTTP_FORBIDDEN
Chapter
2 int
- Bluetooth
1.1
static
OBEX_HTTP_GATEWAY_TIMEOUT
Chapter
3 int
- Before
You Get Started
static
OBEX_HTTP_GONE
Chapter
static
4 int
- Understanding
OBEX_HTTP_INTERNAL_ERROR
the Java Bluetooth API
static
OBEX_HTTP_LENGTH_REQUIRED
Chapter
5 int
- Bluetooth
with J2ME MIDP
static
OBEX_HTTP_MOVED_PERM
Chapter
6 int
- Creating
a Bluetooth Print Server with JPS API
static
Chapter
7 int
- JavaOBEX_HTTP_MOVED_TEMP
and OBEX
static
OBEX_HTTP_MULT_CHOICE
Chapter
8 int
- Using
a Bluetooth Simulator
static
int
OBEX_HTTP_NO_CONTENT
Chapter 9 - Bluetooth
Security
static int OBEX_HTTP_NOT_ACCEPTABLE
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
static int OBEX_HTTP_NOT_AUTHORITATIVE
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
static int OBEX_HTTP_NOT_FOUND
Chapter 12 - Bluetooth and Jini
static int OBEX_HTTP_NOT_IMPLEMENTED
Appendix A - javax.bluetooth
static int OBEX_HTTP_NOT_MODIFIED
Appendix B - javax.obex
static int OBEX_HTTP_OK
Appendix
- JavaOBEX_HTTP_PARTIAL
Bluetooth Development on the PalmOS Platform
staticC int
Appendix
D
BlipNet
1.1 API
static int OBEX_HTTP_PAYMENT_REQUIRED
Index
static int OBEX_HTTP_PRECON_FAILED
List
of Figures
static
int OBEX_HTTP_PROXY_AUTH
List
of Tables
static
int OBEX_HTTP_REQ_TOO_LARGE
List
static
of Listings
int OBEX_HTTP_RESET
static
int OBEX_HTTP_SEE_OTHER
List
of Sidebars
static int OBEX_HTTP_TIMEOUT
static int OBEX_HTTP_UNAUTHORIZED
static int OBEX_HTTP_UNAVAILABLE
static int OBEX_HTTP_UNSUPPORTED_TYPE
static int OBEX_HTTP_USE_PROXY
static int OBEX_HTTP_VERSION
Bluetooth for Java
Class ServerRequestHandler
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
// constructor
The authors of this text describe how to develop wireless Java
protected ServerRequestHandler()
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
// methods Bluetooth-based services, highlights of security concerns, and
HeaderSet createHeaderSet()
more.
long getConnectionID()
void onAuthenticationFailure(byte[] userName)
Table of Contents
int onConnect(HeaderSet request, HeaderSet reply)
Bluetooth
for Java
int onDelete(HeaderSet
request, HeaderSet reply)
Introduction
void onDisconnect(HeaderSet request, HeaderSet reply)
Chapter
1 - Introducing Bluetooth
int onGet(Operation
op)
Chapter
2 - Bluetooth 1.1
int onPut(Operation
op)
Chapter
3 - Before You Get Startedrequest, HeaderSet reply, boolean backup, boolean create)
int onSetPath(HeaderSet
Chapter
void setConnectionID(long
4 - Understanding the Java Bluetooth
id)
API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
Interface SessionNotifier
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
// methods
The authors of this text describe
how to develop wireless Java
javax.microedition.io.Connection
acceptAndOpen(ServerRequestHandler
handler)
applications using Bluetooth for a variety of platforms. This
javax.microedition.io.Connection
acceptAndOpen(ServerRequestHandler
handler,
includes an API overview of the Java library, development of
Authenticator
auth)
Bluetooth-based services, highlights of security concerns,
and
more.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
for Java
AppendixBluetooth
C: Java
Bluetooth Development
on the
ISBN:1590590783
by Bruce Hopkins and Ranjith Antony
© 2003 (352 pages)
PalmOS Apress
Platform
The authors of this text describe how to develop wireless Java
applications
Bluetooth for a
variety
of started
platforms.
Thisthe Impronto Developer Kit 1.0 for
The purpose of this
appendixusing
is to demonstrate
how
to get
using
includes an API overview of the Java library, development of
PalmOS (the Palm
DK).
Bluetooth-based services, highlights of security concerns, and
more.
Note For more updated information, please consult the Palm DK user guides.
Supported Bluetooth Protocols
Table of Contents
Bluetooth for Java
Introduction
The Palm DK supports the following Bluetooth protocols:
Chapter 1
- Introducing Bluetooth
RFCOMM
Chapter 2 - Bluetooth 1.1
Chapter
3 - Before You Get Started
L2CAP
Chapter 4
- Understanding the Java Bluetooth API
SDP
Chapter
5 - Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
OBEX
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
System Requirements
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
Here are the system
requirements
for the Palm DK:
Apress
© 2003 (352 pages)
The authors of this text describe how to develop wireless Java
Pentium-based
PC with at
least
64MB offor
RAM
applications
using
Bluetooth
a variety of platforms. This
includes an API overview of the Java library, development of
Microsoft Windows
2000 service
packhighlights
1 (or higher)
Bluetooth-based
services,
of security concerns, and
more.
Minimum 35MB of free disk space
JDK
1.3.1
Table of
Contents
Bluetooth for Java
PalmOS device with PalmOS 4.0 (or higher)
Introduction
Chapter
1 Bluetooth
- Introducing
Bluetooth
Palm
SDIO
card (or) Sony Bluetooth Memory Stick
Chapter 2 - Bluetooth 1.1
Now, developing
stand-alone Java applications on the PalmOS can be a little cumbersome
Chapter
3 - Beforeordinary,
You Get Started
because
need to create
compile it, build a PRC, and deploy (i.e., HotSync) it on the
Chapter
4 you
- Understanding
theyour
Javaapplication,
Bluetooth API
PDA. It5gets
even more
cumbersome
Chapter
- Bluetooth
with
J2ME MIDP if you develop wireless Java applications because you'll need to
create two-applications
(client and server code) and deploy to two PDAs. Because of this, it is highly
Creating a Bluetooth Print Server with JPS API
recommended that you also get the following:
Chapter 6
Chapter 7
- Java and OBEX
Chapter
8 - Using
a Bluetooth
Simulator
PalmOS
emulator
3.5, with
PalmOS 4.0 ROM (or higher) and Palm's Bluetooth stack
Chapter 9 - Bluetooth Security
TDK
Developers
Kitwith
(includes
TDK
Bluetooth hardware).
Chapter
10 Bluetooth
- Wireless Palm
Embedded
Systems
the Micro
BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
This configuration is shown in Figure C-1.
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Figure C-1: With the TDK Bluetooth Developer's Kit and the PalmOS emulator, you can develop,
deploy, and test your Java Bluetooth applications all within the environment of your development
machine.
Bluetooth for Java
Included Software
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
The following items
are ©included
the Impronto Developer Kit 1.0 for PalmOS:
Apress
2003 (352in
pages)
The authors of this text describe how to develop wireless Java
IBM WebSphere
Micro Environment
for PalmOS
(theofJ9
KVM) This
applications
using Bluetooth
for a variety
platforms.
includes an API overview of the Java library, development of
Apache ANTBluetooth-based
build tool
services, highlights of security concerns, and
more.
Java Bluetooth APIs
Demo
applications
Table of
Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
InstallationBluetooth for Java
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
Installation is pretty
simple.
In (352
order
to run the installer, just execute devkit.exe, and follow the onApress
© 2003
pages)
screen instructions.
The
installation
of
Impronto
will also
install WebSphere Micro
The authors of this textthe
describe
howDeveloper
to developKit
wireless
Java
Environment.
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
services,
highlights .prc
of security
and
To complete yourBluetooth-based
installation, install
the necessary
files onconcerns,
your PDA.
The Impronto Developer Kit
more.
files are
idev_midp_j9.prc
Table of Contents
Bluetooth
idev_racs.prc
for Java
Introduction
idev_utils.prc
- Introducing Bluetooth
Chapter 1
Chapter
2 - Bluetooth 1.1
idev_wrap.prc
Chapter 3
- Before You Get Started
Chapter
The J94VM- .prcs
Understanding
are named
the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
cdlc15.prc
Chapter
7 - Java and OBEX
j9_vm_bundle.prc
Chapter 8
- Using a Bluetooth Simulator
j9pref.prc
Chapter
9 - Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
midp15.prc
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter
12 have
- Bluetooth
and Jini
After you
completed
your installation, verify that everything is correct by running the sample
Appendix
A - MIDP-Chat.
javax.bluetooth
application:
A screenshot of this application is shown in Figure C-2.
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Figure C-2: The MIDP-Chat application
for Java
AppendixBluetooth
D: BlipNet
1.1 API
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
Apress © 2003
pages)
This appendix, presented
here(352
with
permission from Ericsson, contains descriptions of all the fields and
The
authors
of
this
text describe
to develop
wireless
Javathe BlipNet 1.1 API. [1]
method signatures of the classes, interfaces,
andhow
exceptions
that
comprise
applications using Bluetooth for a variety of platforms. This
includes
an API about
overview
of thesee
Javahttp://www.ericsson.com/blipnet.
library, development of
Note For more
information
BlipNet,
Bluetooth-based services, highlights of security concerns, and
more.
Class BlipNetIcons
Table of Contents
public for
class
Bluetooth
Java BlipNetIcons extends java.lang.Object
Introduction
//Package
- Introducing Bluetooth
com.ericsson.blipnet.api.util
Chapter 1
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
//Fields
- Understanding the Java Bluetooth API
static int
BLIPMANAGER_ICON
Chapter
5
- Bluetooth
with J2ME MIDP
static int
BLIPNODE_ALARM_ICON
Chapter
6
Creating
a
Bluetooth Print Server with JPS API
static int BLIPNODE_ICON
Chapter
7
Java
and
OBEX
static int BLIPNODE_LOCKED_ICON
Chapter
8 int
- Using
a Bluetooth Simulator
static
BLIPNODE_NOT_WORKING_ICON
Chapter
9 int
- Bluetooth
Security
static
BLIPNODE_SWUPGRADE_ICON
Chapter
static
10 int
- Wireless
BLIPSERVER_ICON
Embedded Systems with the Micro BlueTarget
static
COMPUTER_DESKTOP_ICON
Chapter
11 int
- Enterprise
Bluetooth Applications with the Ericsson BlipNet
static
COMPUTER_LAPTOP_ICON
Chapter
12 int
- Bluetooth
and Jini
staticA int
COMPUTER_PDA_ICON
Appendix
- javax.bluetooth
static
int
COMPUTER_SERVER_ICON
Appendix B - javax.obex
static
int
LAN_ACCESS_AVAIL_ICON
Appendix C - Java Bluetooth Development on the PalmOS Platform
static int PHONE_CELLULAR_ICON
Appendix D - BlipNet 1.1 API
static int PHONE_SMARTPHONE_ICON
Index
static int SESSION_LAP_ICON
List of Figures
static int SESSION_OPP_ICON
List of Tables
static int UNKNOWN_DEVICE_ICON
Chapter 4
List of Listings
List
of Sidebars
//Methods
static getIcon(ClassOfDevice classOfDevice, boolean javax.swing.ImageIcon
largeIcon)
Returns an ImageIcon illustrating the specified Class of Device.
static javax.swing.ImageIcon
getIcon(int iconId, boolean largeIcon)
Returns a ImageIcon.
[1]Copyright © L.M. Ericsson A/S, Bluetooth Networks
Bluetooth for Java
Interface BlipNode
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
public interface BlipNode extends java.io.Serializable
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
ABlipNode object
contains information about a BlipNode.
Bluetooth-based services, highlights of security concerns, and
more.
//Package
com.ericsson.blipnet.api.blipserver
Table of Contents
Bluetooth for Java
//Methods
Introduction
java.lang.String getBlipNodeFriendlyName()
Chapter 1 - Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Returns3 the
friendly
name
the BlipNode.
Chapter
- Before
You
Get of
Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter
5 - Bluetooth with
J2ME MIDP
java.lang.String
getBlipNodeGroupConfigurationName()
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Returns8 the
Configuration
group
of the BlipNode.
Chapter
- Using
a Bluetooth
Simulator
Chapter 9
- Bluetooth Security
java.lang.String
getBlipNodeGroupName()
Chapter
10 - Wireless Embedded
Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Returns the group name of the BlipNode.
Appendix A - javax.bluetooth
Appendix B - javax.obex
BluetoothAddress getBlipNodeID()
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
Returns the Bluetooth device address of the BlipNode.
List of Figures
List of Tables
java.lang.String getBlipNodeIP()
List of Listings
List of Sidebars
Returns the IP address of the BlipNode.
java.lang.String getUser()
Returns the user of the BlipNode if it was reserved at the time this BlipNode object was created.
boolean isBlipNodeConnected()
Checks whether the BlipNode is connected to the server at the time this BlipNode object was created.
Bluetooth for Java
Interface BlipNodeCause
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
public interface BlipNodeCause
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
This interface defines
the cause values returned in BlipNode events.
Bluetooth-based services, highlights of security concerns, and
more.
//package
com.ericsson.blipnet.api.blipnode
Table of Contents
Bluetooth for Java
//Fields
Introduction
static int CAUSE_BASEBAND_ERROR
Chapter 1 - Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Baseband
in You
BlipNode.
Chapter
3 -error
Before
Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter
5 int
- Bluetooth
with J2ME MIDP
static
CAUSE_BLIPNODE_BLIPSERVER_PROTOCOL_ERROR
Chapter 6 - Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
BlipNode-BlipServer
protocolSimulator
error.
Chapter
8 - Using a Bluetooth
Chapter 9
- Bluetooth Security
static
CAUSE_DHCP_ERROR_LAP
Chapter
10 int
- Wireless
Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
DHCP error (LAN Profile).
Appendix A - javax.bluetooth
Appendix B - javax.obex
static int CAUSE_HOST_STACK_ERROR
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
Host stack error.
List of Figures
List of Tables
static int CAUSE_HOST_TIMEOUT
List of Listings
List of Sidebars
Host timeout.
static int CAUSE_INSUFFICIENT_TERMINAL_CAPABILITIES
Insufficient terminal capabilities.
static int CAUSE_INTERNAL_ERROR
Signifies an internal error in the BlipNode which causes a reboot.
static int CAUSE_LOSS_OF_SIGNAL
Loss of signal.
static int CAUSE_MAX_CONNECTIONS_REACHED
Max connections reached.
Bluetooth for Java
static java.lang.String[] CAUSE_NAMES
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
Thethe
authors
this text describe how to develop wireless Java
Friendly names for
causeofvalues.
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
static int CAUSE_PAGE_TIMEOUT
Bluetooth-based services, highlights of security concerns, and
more.
Page timeout.
Table of Contents
Bluetooth for Java
static int CAUSE_RELAY_AGENT_TO_DHCP_CLIENT_SWITCH
Introduction
Chapter 1
- Introducing Bluetooth
Chapter
2 - BluetoothClient
1.1 switch (rebooting).
Relay Agent/DHCP
Chapter 3 - Before You Get Started
Chapter
4 int
- Understanding
the Java Bluetooth API
static
CAUSE_SESSION_NOT_CREATED
Chapter 5 - Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Session7 not
created.
Chapter
- Java
and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter
static
9 int
- Bluetooth
CAUSE_SYSTEM_ENDED_CONNECTION
Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
System ended connection.
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
staticB int
CAUSE_UNEXPECTED_TERMINAL_BEHAVIOR
Appendix
- javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Unexpected terminal behavior.
Index
List of Figures
static int CAUSE_USER_ENDED_CONNECTION
List of Tables
List of Listings
List
of Sidebars
User
ended connection.
Bluetooth for Java
Interface BlipNodeEvent
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
public interface BlipNodeEvent extends Event
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
An event which indicates
that a BlipNode-related action occurred in the server.
Bluetooth-based services, highlights of security concerns, and
more.
//Package
com.ericsson.blipnet.api.event
Table of Contents
Bluetooth for Java
//Methods
Introduction
boolean equals(java.lang.Object obj)
Chapter 1 - Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Returns3 true
if content
of object
is equal to this.
Chapter
- Before
You Get
Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter
5 - Bluetooth with
J2ME MIDP
java.lang.String
getApplicationName()
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Returns the name of the user/application which has (un)locked the BlipNodeHandle for the BlipNode
Chapter 8 - Using a Bluetooth Simulator
specified in this event.
Chapter 9 - Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
java.lang.String
getBlipNodeFriendlyName()
Chapter
11 - Enterprise Bluetooth
Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Returns the friendly name of the BlipNode which initiated this event.
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
java.lang.String getBlipNodeIP()
Appendix D - BlipNet 1.1 API
Index
List
of Figures
Returns
the IP address of the BlipNode which initiated this event.
List of Tables
List
of Listings
java.lang.String
getBlipNodeSoftwareVersion()
List of Sidebars
Returns the software version of the BlipNode which initiated this event.
int getCause()
Returns the cause of the event.
Bluetooth for Java
Interface BlipNodeHandle
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
public interface BlipNodeHandle
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
ABlipNodeHandle
provides an application access to a physical BlipNode. A BlipNodeHandle is
Bluetooth-based services, highlights of security concerns, and
obtained throughmore.
a BlipServerConnection.
When an application has acquired a BlipNodeHandle, that application has exclusive access to the
physical
BlipNode until the handle is released by calling release().
Table
of Contents
Bluetooth for Java
If the BlipNode disconnects from the server, the handle will be released by the server causing a
BlipNodeHandleReleasedException to be thrown when an application tries to use the handle.
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
//Package
- Before You Get Started
com.ericsson.blipnet.api.blipnode
Chapter 3
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
//Methods
- Creating a Bluetooth Print Server with JPS API
void addToBlipNodeDenyList(BluetoothAddress terminalID)
Chapter 6
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter
9 specified
- Bluetooth
Security
Adds the
device
ID to the local deny list on this BlipNode.
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter
11 - Enterprise Bluetooth Applications with the Ericsson
BlipNet
void addToInquiryFilter(BluetoothAddress
terminalID,
int timeout)
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Adds theB specified
terminal to the inquiry filter in this BlipNode.
Appendix
- javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
void changeInquiryLength(int
inquiryLength)
Appendix
D - BlipNet 1.1 API
Index
List of Figures
Dynamically configures the length of time (in units of 1.28 s) in which the BlipNode performs inquiry before
restarting inquiry or switching to Scan.
List of Tables
List of Listings
List of Sidebars
void changeLinkEstablishmentMode(boolean
automaticLinkEstablishmentOn, boolean nameLookupOn)
Dynamically switch the BlipNode in and out of automatic link establishment mode.
void changeScanLength(int scanLength)
Dynamically configures the length of time (in units of 1.28 s) in which terminals are able to detect the
BlipNode during inquiry or paging.
void changeScanMode(ScanMode scanMode)
Dynamically changes the Scan mode on the BlipNode.
void clearBlipNodeDenyList()
Clears the local deny list on this BlipNode.
void disconnectLink(BluetoothAddress
terminalID, int inquiryFilterTime)
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
Disconnects the specified terminal from this BlipNode if it is connected.
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java
library, development
of
void establishLink(BluetoothAddress
terminalID,
ClassOfDevice
terminalCOD)
Bluetooth-based services, highlights of security concerns, and
more.
Attempts to establish a link to the specified terminal.
Table of Contents
void establishLink(PageData
p)
Bluetooth
for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Attempts to establish a link to the terminal specified in the paging data.
void exchangeBusinessCards(BluetoothAddress
terminalID)
- Understanding the Java Bluetooth API
Chapter 4
Chapter 5
- Bluetooth with J2ME MIDP
Chapter
- Creatingcard
a Bluetooth
Print
Server with
JPS API terminal and the BlipNode if the terminal is
Initiates6a business
exchange
between
the specified
Chapter
7
Java
and
OBEX
connected to the BlipNode.
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Link[] getActiveLinks()
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter
Returns12a -list
Bluetooth
of links that
and Jini
are currently active on the BlipNode.
Appendix A - javax.bluetooth
Appendix
B - javax.obex
BluetoothAddress[]
getBlipNodeDenyList()
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Retrieves a list of terminals in this BlipNode's deny list.
Index
List of Figures
BluetoothAddress
getBlipNodeID()
List
of Tables
List of Listings
List of Sidebars
Returns the Bluetooth device address of the BlipNode connected to this handle.
void pullBusinessCard(BluetoothAddress terminalID)
Attempts to pull the business card from the specified terminal.
void push(ObexPushObject pushObject, BluetoothAddress terminalID)
Pushes the specified object to the specified terminal if it is connected to the BlipNode.
void push(ObexPushObject pushObject, BluetoothAddress terminalID,
ObexProgressListener listener)
Pushes the specified object to the specified terminal if it is connected to the BlipNode.
void pushBusinessCard(BluetoothAddress terminalID)
Pushes this BlipNode's
business
card to the specified terminal if the terminal is connected to the BlipNode.
Bluetooth
for Java
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
void release()
Apress © 2003 (352 pages)
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
Releases the BlipNodeHandle
for use of
bythe
other
applications.
includes an API overview
Java
library, development of
Bluetooth-based services, highlights of security concerns, and
more.
void removeFromBlipNodeDenyList(BluetoothAddress terminalID)
Table of Contents
Removesforthe
specified device from the local deny list on this BlipNode.
Bluetooth
Java
Introduction
void removeSession(BluetoothAddress
terminalID, Session sessionType)
Chapter
1 - Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Removes the specified session from this BlipNode if the session exists.
void setBlipNodeDenyList(BluetoothAddress[]
terminalIDs)
- Creating a Bluetooth Print Server with JPS API
Chapter 6
Chapter 7
- Java and OBEX
Chapter
8 local
- Using
a Bluetooth
Sets the
deny
list on thisSimulator
BlipNode to the specified list.
Chapter 9 - Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
void setBusinessCard(java.lang.String businessCard)
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix
A - the
javax.bluetooth
Configures
business card of this BlipNode.
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
Class BlipNodeHandleInUseException
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
public final class BlipNodeHandleInUseException extends BlipServerException
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Thrown by BlipServerConnection
when an application attempts to get a handle for a BlipNode which
Bluetooth-based services, highlights of security concerns, and
is already used by
another
application.
more.
//Package
com.ericsson.blipnet.api.blipnode
Table of Contents
Bluetooth for Java
Introduction
//Constructors
Chapter
1 - Introducing Bluetooth
BlipNodeHandleInUseException()
Chapter
2 - Bluetooth 1.1
BlipNodeHandleInUseException(java.lang.String
s)
Chapter
3 - Before You Get Started
BlipNodeHandleInUseException(java.lang.String
s,
Chapter
4 - Understanding the
java.lang.Throwable
e)Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
Class BlipNodeHandleReleasedException
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
public final class BlipNodeHandleReleasedException extends
The authors of this text describe how to develop wireless Java
BlipServerException
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
Thrown by BlipNodeHandle
when an application attempts to execute a method on a released
more.
BlipNodeHandle.
The of
handle
may have been released either by the application itself or by the server (due to a reboot of the
Table
Contents
BlipNode).
Bluetooth
for Java
Introduction
Chapter
//Package
1 - Introducing Bluetooth
com.ericsson.blipnet.api.blipnode
Chapter
2 - Bluetooth 1.1
Chapter 3
- Before You Get Started
//Constructors
Chapter
4 - Understanding the Java Bluetooth API
BlipNodeHandleReleasedException()
Chapter
5 - Bluetooth with J2ME MIDP
BlipNodeHandleReleasedException(java.lang.String
s)
Chapter
6 - Creating a Bluetooth Print Server with JPS API
BlipNodeHandleReleasedException(java.lang.String
s,
- Java and OBEX
java.lang.Throwable e)
Chapter 7
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
Class BlipNodeNotConnectedException
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
public final class BlipNodeNotConnectedException extends
The authors of this text describe how to develop wireless Java
BlipServerException
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
Thrown by a BlipServerConnection
when an application tries to get a BlipNodeHandle for a
more.
BlipNode which is not connected to the server.
Table of Contents
//Package
com.ericsson.blipnet.api.blipnode
Bluetooth for Java
Introduction
Chapter
1 - Introducing Bluetooth
//Constructors
Chapter
2 - Bluetooth 1.1
BlipNodeNotConnectedException()
Chapter
3 - Before You Get Started
BlipNodeNotConnectedException(java.lang.String
s)
Chapter
4 - Understanding the Java Bluetooth API
BlipNodeNotConnectedException(java.lang.String
s,
Chapter
java.lang.Throwable
5 - Bluetooth with J2ME
e) MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
Class BlipServer
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
public final class BlipServer extends java.lang.Object
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
an API overview of the Java library, development of
Factory class for includes
getting BlipServerConnections.
Bluetooth-based services, highlights of security concerns, and
more.
//Package
com.ericsson.blipnet.api.blipserver
Table of Contents
Bluetooth for Java
//Constructors
Introduction
BlipServer()
Chapter 1
- Introducing Bluetooth
Chapter
2 - Bluetooth 1.1
//Methods
Chapter
3 getConnection(java.lang.String
- Before You Get Started
static
username, BlipServerConnection
Chapter
4 - Understanding
the Java Bluetooth
API
java.lang.String
password,
java.lang.String
serverHost)
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Returns a -BlipServerConnection
to the specified server using default values for port number and
Java and OBEX
service name.
Chapter 8 - Using a Bluetooth Simulator
Chapter 7
Chapter 9
- Bluetooth Security
static
Chapter
10 getConnection(java.lang.String
- Wireless Embedded Systems with the Microusername,
BlueTarget BlipServerConnection
java.lang.String
password,
java.lang.String
serverHost, int serverPort,
Chapter
11 - Enterprise Bluetooth
Applications
with the Ericsson BlipNet
java.lang.String serverServiceName)
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix
javax.obex
Returns Ba -BlipServerConnection
to the specified server.
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
Class BlipServerAccessException
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
public class BlipServerAccessException extends BlipServerException
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Thrown by a BlipServerConnection
when an application tries to access the server with invalid
Bluetooth-based services, highlights of security concerns, and
username or password.
The
reason
for
denying
access can be wrong username/password or access from
more.
a host other than the host associated with this account.
Table of Contents
//Package
com.ericsson.blipnet.api.blipserver
Bluetooth for Java
Introduction
Chapter
1 - Introducing Bluetooth
//Constructors
Chapter
2 - Bluetooth 1.1
BlipServerAccessException(java.lang.String
s)
Chapter
3 - Before You Get Started
BlipServerAccessException(java.lang.String
s, java.lang.Throwable e)
Chapter 4 - Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
Interface BlipServerConnection
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
public interface BlipServerConnection
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
ABlipServerConnection
is used to attach BlipNode event listeners to the server, and to get handles
Bluetooth-based services, highlights of security concerns, and
for connected BlipNodes.
more.
//Package
com.ericsson.blipnet.api.blipserver
Table of Contents
Bluetooth for Java
Introduction
//Methods
Chapter
1 - Introducing Bluetooth
void addEventListener(BlipServerEventListener
listener)
Chapter 2 - Bluetooth 1.1
Chapter 3
- Before You Get Started
Adds the
listenerthe
to the
BlipServer.
Chapter
4 specified
- Understanding
Java
Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter
void addEventListener(BlipServerEventListener
6 - Creating a Bluetooth Print Server with JPS API
listener,
BlipServerEventFilter
filter)
Chapter
7 - Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Adds the specified listener to the BlipServer.
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
java.lang.String[]
getBlipNodeConfigurationGroupNames()
Chapter
12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Returns a list of the configuration names which are currently defined in the server.
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
java.lang.String[] getBlipNodeGroupNames()
Index
List of Figures
List
of Tables
Returns
a list of BlipNode group names which are currently defined in the server.
List of Listings
List
of Sidebars
BlipNodeHandle
getBlipNodeHandle(BluetoothAddress blipNodeID)
Returns a handle to the BlipNode with the specified ID if it is connected to the server, or null if the
BlipNode is not connected or the handle is already in use by another application.
BlipNodeHandle getBlipNodeHandleFromGroup(java.lang.String blipNodeGroupName)
Returns a handle to the first available BlipNode from the specified BlipNode group.
BlipNode[] getBlipNodes(java.lang.String groupName,java.lang.String
blipNodeGroupConfigurationName,boolean includeReservedBlipNodes,
boolean includeDisconnectedBlipNodes)
Returns a list of BlipNodes which match the specified criteria.
BluetoothAddress getConnectedBlipNode(BluetoothAddress terminalID)
Returns the Bluetooth device address of the BlipNode to which the specified terminal is connected.
Bluetooth for Java
BluetoothAddress[] getConnectedTerminals()
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications
using Bluetooth
forto
a the
variety
of platforms. This
Returns a list of terminals
currently
connected
server.
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
byte[] getObexObject(java.io.File
file)
Table
of Contents
Returns
the contents of the specified file if the file is found on the server.
Bluetooth for Java
Introduction
void releaseBlipNodeHandle(BluetoothAddress blipNodeID)
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter
Releases
3 the
- Before
handle
YoutoGet
theStarted
specified BlipNode if the handle was reserved by this user.
Chapter 4
- Understanding the Java Bluetooth API
Chapter
5 - Bluetooth with J2ME MIDP
void removeEventListener(BlipServerEventListener
listener)
Chapter 6 - Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Removes
specified
listener
from the server.
Chapter
8 the
- Using
a Bluetooth
Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
Class BlipServerConnectionException
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
public final class BlipServerConnectionException extends
The authors of this text describe how to develop wireless Java
BlipServerException
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
Thrown by a BlipServerConnection
if the connection to the server is lost.
more.
//Package
com.ericsson.blipnet.api.blipserver
Table of Contents
Bluetooth for Java
Introduction
//Constructors
Chapter
1 - Introducing Bluetooth
BlipServerConnectionException(java.lang.String
s, java.lang.Throwable e)
Chapter 2 - Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
Class BlipServerEventAdapter
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
public abstract class BlipServerEventAdapter extends java.lang.Object
The authors of this text describe how to develop wireless Java
implements BlipServerEventListener
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
An abstract adapter
class for receiving events from the BlipServer. The methods in this class are empty.
more.
The class exists as convenience for creating listener objects which only listens to a certain class of events.
Table of Contents
// package
com.ericsson.blipnet.api.event
Introduction
//Constructors
Chapter
1 - Introducing Bluetooth
BlipServerEventAdapter()
Bluetooth for Java
Chapter 2
- Bluetooth 1.1
Chapter
3 - Before You Get Started
//Methods
Chapter
4 - Understanding the Java Bluetooth API
void handleBlipNodeEvent(BlipNodeEvent
e)
Chapter 5 - Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Called by the
BlipServer event dispatcher when a BlipNodeEvent occurs.
- Java and OBEX
Chapter 7
Chapter 8
- Using a Bluetooth Simulator
void handleConnectionEvent(ConnectionEvent
e)
Chapter
9 - Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Called by the BlipServer event dispatcher when a ConnectionEvent occurs.
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
void handleObexEvent(ObexEvent e)
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix
D the
- BlipNet
1.1 API
Called by
BlipServer
event dispatcher when an ObexEvent occurs.
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
Class BlipServerEventFilter
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
public final class BlipServerEventFilter extends java.lang.Object
The authors of this text describe how to develop wireless Java
implements java.io.Serializable
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
This class is usedmore.
to filter notification of events for client applications which implement
BlipServerEventListener.
Table of Contents
//Package
com.ericsson.blipnet.api.event
Bluetooth for Java
Introduction
Chapter
1 - Introducing Bluetooth
//Constructors
Chapter
2 - Bluetooth 1.1
BlipServerEventFilter(int[]
eventClasses, int[] eventIDs,
Chapter
3 - Before You Get blipNodeIDs,
Started
BluetoothAddress[]
BluetoothAddress[] terminalIDs)
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Constructs
BlipServerEventFilter.
Chapter
6 - aCreating
a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
//Methods
Chapter
8 - Using a Bluetooth Simulator
boolean
Chapter
9 -contains(Event
Bluetooth Security event)
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Checks whether the listener attached to this filter should be notified of the specified event.
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
boolean containsBlipNodeID(BluetoothAddress blipNodeID)
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix
- BlipNet
API
Checks D
whether
the1.1
specified
BlipNode ID is included in this filter.
Index
List of Figures
boolean containsEventClass(int eventClass)
List
of TablescontainsEventID(int eventID)
boolean
List
of
Listings
boolean
containsTerminalID(BluetoothAddress terminalID)
List of Sidebars
Checks whether the specified terminal ID is included in this filter.
BluetoothAddress[] getBlipNodeIDs()
Returns a copy of the blipNodeIDs of the BlipServerEventFilter.
int[] getEventClasses()
Returns a copy of the eventClasses of the BlipServerEventFilter.
int[] getEventIDs()
Returns a copy of the eventTypes of the BlipServerEventFilter.
BluetoothAddress[] getTerminalIDs()
Returns a copy of the terminalIDs of the BlipServerEventFilter.
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
Interface BlipServerEventListener
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
public interface BlipServerEventListener
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
This interface should
be implemented by client classes wishing to listen to events generated by the
Bluetooth-based services, highlights of security concerns, and
BlipServer.
more.
//Package
com.ericsson.blipnet.api.event
Table of Contents
Bluetooth for Java
Introduction
//Methods
Chapter
1 - Introducing Bluetooth
void handleBlipNodeEvent(BlipNodeEvent
e)
Chapter 2 - Bluetooth 1.1
Chapter 3
- Before You Get Started
Called 4by the
BlipServer event
dispatcher
when
Chapter
- Understanding
the Java
Bluetooth
API a BlipNodeEvent occurs.
Chapter 5
- Bluetooth with J2ME MIDP
Chapter
void handleConnectionEvent(ConnectionEvent
6 - Creating a Bluetooth Print Server with JPS API
e)
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Called by the BlipServer event dispatcher when a ConnectionEvent occurs.
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
void handleObexEvent(ObexEvent
Chapter
11 - Enterprise Bluetooth Applicationse)
with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Called by the BlipServer event dispatcher when an ObexEvent occurs.
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
Class BlipServerException
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
public class BlipServerException extends java.lang.Exception
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Superclass for allBluetooth-based
exceptions which
can be thrown by the BlipServer.
services, highlights of security concerns, and
more.
//Package
com.ericsson.blipnet.api.blipserver
Table of Contents
Bluetooth for Java
//Constructors
Introduction
BlipServerException()
Chapter
1 - Introducing Bluetooth
BlipServerException(java.lang.String
s)
Chapter
2 - Bluetooth 1.1
BlipServerException(java.lang.String
s, java.lang.Throwable e)
Chapter 3 - Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
Class BluetoothAddress
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
public final class BluetoothAddress extends java.lang.Object implements
The authors of this text describe how to develop wireless Java
java.io.Serializable
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
TheBluetoothAddress
class models a Bluetooth Device Address (BD_ADDR). This is a 48 bit unsigned
more.
integer, often written in hexadecimal.
Objects
of the BluetoothAddress class are immutable—once created they cannot change.
Table
of Contents
Bluetooth for Java
This class provides the equals and hashCode methods for use in connection with the Collection
classes.
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
//Package
- Before You Get Started
com.ericsson.blipnet.api.Bluetooth
Chapter 3
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
//Constructors
- Creating a Bluetooth Print Server with JPS API
BluetoothAddress(byte[] bluetoothAddress)
Chapter 6
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter
Constructs
9 - aBluetooth
BluetoothAddress
Security
object from a byte[].
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter
11 - Enterprise Bluetooth Applications withbluetoothAddress)
the Ericsson BlipNet
BluetoothAddress(java.lang.String
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Constructs
BluetoothAddress object from a String.
Appendix
B - ajavax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
//Methods
Appendix
D - BlipNet 1.1 API
boolean equals(java.lang.Object obj)
Index
List of Figures
List of Tables
Compares this BluetoothAddress with an Object and returns true if they are equal.
List of Listings
List of Sidebars
byte[] getBytes()
int hashCode()
Returns a hashCode for this BluetoothAddress.
java.lang.String toString()
Returns a String representation of this BluetoothAddress.
Bluetooth for Java
Class ClassOfDevice
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
public final class ClassOfDevice extends java.lang.Object implements
The authors of this text describe how to develop wireless Java
java.io.Serializable
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
TheClassOfDevice
more. class models a class of device. This is a 24 bit unsigned integer, often written in
hexadecimal.
Objects
of the ClassOfDevice class are immutable—once created they cannot change.
Table
of Contents
Bluetooth for Java
This class provides the equals and hashCode methods for use in connection with the Collection
classes.
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
//Package
- Before You Get Started
com.ericsson.blipnet.api.Bluetooth
Chapter 3
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
//Fields
- Creating a Bluetooth Print Server with JPS API
static java.lang.String AV
Chapter 7 - Java and OBEX
static java.lang.String AV_CAMCORDER
Chapter
8 java.lang.String
- Using a Bluetooth Simulator
static
AV_CAR_AUDIO
Chapter
9
- Bluetooth Security
static java.lang.String
AV_GAMING_TOY
Chapter
10 java.lang.String
- Wireless Embedded Systems
with the Micro BlueTarget
static
AV_HANDS_FREE
Chapter
11
Enterprise
Bluetooth
Applications
with the Ericsson BlipNet
static java.lang.String AV_HEADPHONES
Chapter
12
Bluetooth
and
Jini
static java.lang.String AV_HEADSET
Appendix
staticA java.lang.String
- javax.bluetooth
AV_HIFI
staticB java.lang.String
AV_LOUDSPEAKER
Appendix
- javax.obex
staticC java.lang.String
AV_MICROPHONE
Appendix
- Java Bluetooth Development
on the PalmOS Platform
staticD java.lang.String
AV_PORTABLE_AUDIO
Appendix
- BlipNet 1.1 API
static java.lang.String AV_SET_TOP_BOX
Index
static
java.lang.String AV_SHORT
List
of Figures
static
java.lang.String
AV_VCR
List of Tables
static java.lang.String AV_VIDEO_CAMERA
List of Listings
static java.lang.String AV_VIDEO_CONF
List of Sidebars
static java.lang.String AV_VIDEO_DISPLAY
static java.lang.String AV_VIDEO_MONITOR
static java.lang.String BLIPNODE_CLASS_OF_DEVICE
static java.lang.String COMPUTER
static java.lang.String COMPUTER_DESKTOP
static java.lang.String COMPUTER_HANDHELD
static java.lang.String COMPUTER_LAPTOP
static java.lang.String COMPUTER_PALM_SIZED
static java.lang.String COMPUTER_SERVER_CLASS
static java.lang.String COMPUTER_SHORT
static java.lang.String COMPUTER_WEARABLE
static java.lang.String IMAGING
static java.lang.String IMAGING_CAMERA
static java.lang.String IMAGING_DISPLAY
static java.lang.String IMAGING_PRINTER
static java.lang.String IMAGING_SCANNER
static java.lang.String IMAGING_SHORT
static java.lang.String LAN_ACCESS_POINT
static java.lang.String LAN_ACCESS_POINT_FIFTH
static java.lang.String LAN_ACCESS_POINT_FIRST
static java.lang.String LAN_ACCESS_POINT_FOURTH
Chapter 6
static java.lang.String LAN_ACCESS_POINT_FULLY
Bluetooth for Java
static java.lang.String
LAN_ACCESS_POINT_NO_SERVICE
ISBN:1590590783
by Bruce HopkinsLAN_ACCESS_POINT_SECOND
and Ranjith Antony
static java.lang.String
Apress
©
2003
(352
pages)
static java.lang.String LAN_ACCESS_POINT_SHORT
The authors of this
text describe how to develop wireless Java
static java.lang.String
LAN_ACCESS_POINT_SIXTH
applications
using
Bluetooth
for a variety of platforms. This
static java.lang.String LAN_ACCESS_POINT_THIRD
includes an API overview of the Java library, development of
static java.lang.String
PERIPHERAL
Bluetooth-based services,
highlights of security concerns, and
static java.lang.String
PERIPHERAL_COMBO
more.
static java.lang.String PERIPHERAL_DIGITIZER
static java.lang.String PERIPHERAL_GAMEPAD
Table
of Contents
static
java.lang.String PERIPHERAL_JOYSTICK
Bluetooth
Java
static for
java.lang.String
PERIPHERAL_KEYBOARD
Introduction
static java.lang.String PERIPHERAL_POINTING_DEV
Chapter
1 java.lang.String
- Introducing Bluetooth PERIPHERAL_REMOTE
static
Chapter
static
2 java.lang.String
- Bluetooth 1.1
PERIPHERAL_SENSING_DEV
static
Chapter
3 java.lang.String
- Before You Get StartedPERIPHERAL_SHORT
static
PHONE
Chapter
4 java.lang.String
- Understanding the Java
Bluetooth API
static
PHONE_CELLULAR
Chapter
5 java.lang.String
- Bluetooth with J2ME MIDP
static
PHONE_CORDLESS
Chapter
6 java.lang.String
- Creating a Bluetooth Print
Server with JPS API
static
PHONE_ISDN
Chapter
7 java.lang.String
- Java and OBEX
static java.lang.String PHONE_SHORT
Chapter 8 - Using a Bluetooth Simulator
static java.lang.String PHONE_SIMCARD
Chapter 9 - Bluetooth Security
static java.lang.String PHONE_SMART_PHONE
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
static java.lang.String PHONE_WIRED
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
static java.lang.String UNKNOWN
Chapter 12 - Bluetooth and Jini
static java.lang.String UNKNOWN_SHORT
Appendix A - javax.bluetooth
Appendix
B - javax.obex
//Constructors
Appendix
C - Java Bluetooth Development
on the PalmOS
Platform
ClassOfDevice(boolean
limitedDisc,
boolean
positioning, boolean networking,
Appendix
D
BlipNet
1.1
API
boolean rendering, boolean capturing, boolean objectTransfer, boolean audio,
Index
boolean telephony, boolean information, java.lang.String majorClass,
List
java.lang.String
of Figures
minorClass)
List of Tables
List of Listings
Constructs a ClassOfDevice object.
List of Sidebars
ClassOfDevice(byte[] classOfDevice)
Constructs a ClassOfDevice object from a byte[].
ClassOfDevice(java.lang.String classOfDevice)
Constructs a ClassOfDevice object from a string.
//Methods
boolean equals(java.lang.Object obj)
Compares this ClassOfDevice with an Object and returns true if they are equal.
byte[] getBytes()
Returns the byte representation of this ClassOfDevice object.
Bluetooth for Java
int getIconId()
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
Returns the Icon The
Id for
the Class
of text
Device.
authors
of this
describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes
an API overview of the Java library, development of
java.lang.String
getMajorTypeText()
Bluetooth-based services, highlights of security concerns, and
more.
Returns the Class of Device Major type as a Long text description.
Table of Contents
Bluetooth
for Java
java.lang.String
getMajorTypeText(boolean longText)
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 3
- Before You Get Started
Returns the Class of Device Major type as a text description.
Chapter 2 - Bluetooth 1.1
java.lang.String
getMinorTypeText()
Chapter
4 - Understanding
the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Returns the Class of Device Minor type as a text description.
int hashCode()
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter
Enterprise Bluetooth
Applications
with the Ericsson BlipNet
Returns11a -hashCode
for this Class
Of Device.
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
boolean isAudioSet()
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix
Examines
D -the
BlipNet
Audio1.1
bitAPI
of the Class Of Device.
Index
List
of Figures
boolean
isCapturingSet()
List of Tables
List of Listings
Examines
the Capturing bit of the Class Of Device.
List
of Sidebars
boolean isInformationSet()
Examines the Information bit of the Class Of Device.
boolean isLimitedDiscoverableSet()
Examines the Limited Discoverable bit of the Class Of Device.
boolean isNetworkingSet()
Examines the Networking bit of the Class Of Device.
boolean isObjectTransferSet()
Examines the Object Transfer bit of the Class Of Device.
boolean isPositioningSet()
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
Apress © 2003
Examines the Positioning
bit of(352
thepages)
Class Of Device.
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
boolean isRenderingSet()
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
Examines the Rendering bit of the Class Of Device.
Table of Contents
boolean isTelephonySet()
Bluetooth for Java
Introduction
Chapter
Examines
1 -the
Introducing
Telephony
Bluetooth
bit of the Class Of Device.
Chapter 2
- Bluetooth 1.1
Chapter
3 - Before You Get
Started
java.lang.String
toString()
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Returns6 a -String
of this
Class
Device.
Chapter
Creatingrepresentation
a Bluetooth Print
Server
withOf
JPS
API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
Interface ConnectionEvent
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
public interface ConnectionEvent extends Event
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
An event indicating
that a connection-related action has occurred in the server.
Bluetooth-based services, highlights of security concerns, and
more.
//Package
com.ericsson.blipnet.api.event
Table of Contents
Bluetooth for Java
//Methods
Introduction
boolean equals(java.lang.Object obj)
Chapter 1 - Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Returns3 true
if content
of object
is equal to this.
Chapter
- Before
You Get
Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter
5 - Bluetooth with J2ME MIDP
int getCause()
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Returns8 the
causea of
this event.
Chapter
- Using
Bluetooth
Simulator
Chapter 9
- Bluetooth Security
int getSessionType()
Chapter
10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Returns the type of session that this event is related to.
Appendix A - javax.bluetooth
Appendix B - javax.obex
ShortUuid[] getShortUUIDs()
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
Returns an array of short UUIDs representing the services supported by the terminal to which this event is
List
of Figures
related.
List of Tables
List
of Listings
java.lang.String
getTerminalClassOfDevice()
List of Sidebars
Returns the class of device of the terminal to which this event is related.
java.lang.String getTerminalFriendlyName()
Returns the friendly name of the terminal to which this event is related.
BluetoothAddress getTerminalID()
Returns the Bluetooth device address of the terminal to which this event is related.
java.lang.String getTerminalIP()
Returns the IP address of the terminal to which this event is related.
Bluetooth for Java
Class EricssonMelody
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
public final class EricssonMelody extends java.lang.Object implements
The authors of this text describe how to develop wireless Java
ObexPushObject
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
AnObexPushObject
more. implementation of an Ericsson Melody. This class wraps the given melody string in
a format understandable by an Ericsson Mobile Phone.
Table of Contents
//Package
com.ericsson.blipnet.api.obex.pushobjects
Bluetooth for Java
Introduction
Chapter
1 - Introducing Bluetooth
//Constructors
Chapter
2 - Bluetooth 1.1
EricssonMelody(java.lang.String
melody)
Chapter 3 - Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Constructs
Ericsson
Melody
Chapter
5 - an
Bluetooth
with
J2ME push
MIDP object with a default name (NONAME.EMY).
Chapter 6
- Creating a Bluetooth Print Server with JPS API
EricssonMelody(java.lang.String
melody, java.lang.String name)
Chapter
7 - Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Constructs an Ericsson Melody push object with the name specified.
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
//Methods
Chapter
12 - Bluetooth and Jini
byte[] getObexBody()
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix
- Java
Development on the PalmOS Platform
Returns Cthe
bodyBluetooth
of this ObexPushObject.
Appendix D - BlipNet 1.1 API
Index
java.lang.String getObexName()
List of Figures
List of Tables
List
Returns
of Listings
the name of this ObexPushObject.
List of Sidebars
java.lang.String getObexType()
Returns the mime-type of this ObexPushObject.
Bluetooth for Java
Interface Event
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
public interface Event extends java.io.Serializable
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
The superclass ofBluetooth-based
all events. Thisservices,
interfacehighlights
defines common
event methods and contains event ID
of security concerns, and
definitions for all events.
more.
//Package
com.ericsson.blipnet.api.event
Table of Contents
Bluetooth for Java
Introduction
//Fields
Chapter
1 int
- Introducing
Bluetooth
static
BLIPNODE_ALARM
Chapter 2 - Bluetooth 1.1
Chapter 3
- Before You Get Started
Indicates
a critical condition
has
occurred
in a BlipNode connected to the server.
Chapter
4 that
- Understanding
the Java
Bluetooth
API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter
static
6 int
- Creating
BLIPNODE_DEREGISTERED
a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Indicates that
a BlipNode has disconnected from the server.
- Bluetooth Security
Chapter 9
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
static
BLIPNODE_EVENT
Chapter
11 int
- Enterprise
Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Event class of BlipNode-related events.
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
static int BLIPNODE_LOCKED
Appendix D - BlipNet 1.1 API
Index
List
of Figures
Indicates
that an application has acquired the lock on a BlipNode.
List of Tables
List
of Listings
static
int BLIPNODE_REGISTERED
List of Sidebars
Indicates that a BlipNode has connected to the server.
static int BLIPNODE_RELEASED
Indicates that an application has released its lock on a BlipNode.
static int BLIPNODE_STARTUP_FAILED
Indicates that a BlipNode attempted to connect to the server, but the startup failed for some reason.
static int BLIPNODE_SW_UPGRADE_COMPLETE
Indicates that a BlipNode software upgrade has been completed successfully.
static int BLIPNODE_SW_UPGRADE_FAILED
Indicates that a BlipNode software update failed.
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
static int BLIPNODE_SW_UPGRADE_STARTED
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
Indicates that a BlipNode
software upgrade has been initiated.
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
static int BLIPNODE_WAITING_FOR_CONFIGURATION
Table of Contents
Indicates that a BlipNode has registered with the server, but no configuration exists for that BlipNode.
Bluetooth for Java
Introduction
static java.lang.String[] CLASS_NAMES
- Introducing Bluetooth
static int CONNECTION_EVENT
Chapter 1
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter
4 - Understanding
the Java events.
Bluetooth API
Event class
of Connection-related
Chapter 5
- Bluetooth with J2ME MIDP
Chapter
6 java.lang.String[]
- Creating a Bluetooth PrintFRIENDLY_NAMES
Server with JPS API
static
Chapter
7
Java
and
OBEX
static int OBEX_BUSINESS_CARD_EXCHANGE_COMPLETED
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Indicates
completionSystems
of a business
exchange.
Chapter
10 successful
- Wireless Embedded
with thecard
Micro
BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
static
OBEX_BUSINESS_CARD_EXCHANGE_FAILED
Chapter
12 int
- Bluetooth
and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Indicates a failed attempt to exchange business cards with a terminal.
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
static int OBEX_BUSINESS_CARD_PULL_COMPLETED
Index
List of Figures
List of Tables
Indicates successful completion of a business card pull.
List of Listings
List of Sidebars
static int OBEX_BUSINESS_CARD_PULL_FAILED
Indicates a failed attempt to pull business card from a terminal.
static int OBEX_EVENT
Event class of OBEX-related events.
static int OBEX_OBJECT_RECEIVED
Indicates that an OBEX object has been received and stored by the server.
static int OBEX_PUSH_COMPLETED
Indicates successful completion of an OBEX push.
static int OBEX_PUSH_FAILED
Bluetooth for Java
Indicates a failed attempt to push an OBEX object to a terminal.
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
static int OBEX_PUSH_PROGRESS
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Indicates progress
in an ongoing services,
OBEX push.
Bluetooth-based
highlights of security concerns, and
more.
static int TERMINAL_DETECTED
Table of Contents
Bluetooth for Java
Indicates that a terminal was detected in inquiry.
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
static int TERMINAL_LINK_ESTABLISH_FAILED
Chapter
4 a- failed
Understanding
theestablish
Java Bluetooth
API link to a terminal.
Indicates
attempt to
a Bluetooth
Chapter 5 - Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
static int
TERMINAL_LINK_ESTABLISHED
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter
Indicates
9 that
- Bluetooth
a Bluetooth
Security
link to a terminal has been established.
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter
11 int
- Enterprise
Bluetooth Applications with the Ericsson BlipNet
static
TERMINAL_LINK_LOST
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
IndicatesB that
a Bluetooth link to a terminal has been disconnected.
Appendix
- javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
staticD int
TERMINAL_SESSION_CREATE_FAILED
Appendix
- BlipNet
1.1 API
Index
List of Figures
Indicates a failed attempt to create a session with a terminal.
List of Tables
List of Listings
static int TERMINAL_SESSION_CREATED
List of Sidebars
Indicates that a session has been created with a terminal.
static int TERMINAL_SESSION_REMOVED
Indicates that a session with a terminal has been removed.
//Methods
boolean equals(java.lang.Object obj)
Returns true if content of object is equal to this.
BluetoothAddress getBlipNodeID()
Returns the Bluetooth device address of the BlipNode to which this event is related.
int getEventClass()
Bluetooth for Java
Returns the event class of this event.
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
int getEventID()
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
services, highlights of security concerns, and
Returns the ID ofBluetooth-based
this event.
more.
java.lang.String getMessage()
Table of Contents
Bluetooth for Java
Returns the message associated with this event if any.
Introduction
Chapter 1
- Introducing Bluetooth
int hashCode()
Chapter
2 - Bluetooth 1.1
java.lang.String toString()
Chapter 3 - Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter
Bluetooth
with J2ME MIDP
Returns5 a -String
representation
of this event.
Chapter 6 - Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
Interface InquiryResultEvent
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
public interface InquiryResultEvent extends ConnectionEvent
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
An event indicating
that a terminal has been detected by a BlipNode in Inquiry Only Mode.
Bluetooth-based services, highlights of security concerns, and
more.
//Package
com.ericsson.blipnet.api.event
Table of Contents
Bluetooth for Java
//Methods
Introduction
PageData getPageData()
Chapter 1 - Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Returns3 the
PagingYou
data
Chapter
- Before
Getneeded
Startedfor direct paging of this terminal.
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
Interface Link
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
public interface Link extends java.io.Serializable
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
TheLink interface
provides methods to retrieve snapshot information about a specific BlipNode-Terminal
Bluetooth-based services, highlights of security concerns, and
link.
more.
//Package
com.ericsson.blipnet.api.Bluetooth
Table of Contents
Bluetooth for Java
Introduction
//Methods
Chapter
1 -equals(java.lang.Object
Introducing Bluetooth
boolean
obj)
Chapter 2 - Bluetooth 1.1
Chapter 3
- Before You Get Started
Compares
LinkImplthe
withJava
an Object
Chapter
4 - this
Understanding
Bluetoothand
API returns true if they are equal.
Chapter 5
- Bluetooth with J2ME MIDP
Chapter
BluetoothAddress
6 - Creating a Bluetooth
getBlipNode()
Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Returns the BluetoothAddress of the BlipNode using this session.
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
int[]11getCurrentSessions()
Chapter
- Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Returns an array of active sessions on this link.
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
BluetoothAddress getTerminal()
Appendix D - BlipNet 1.1 API
Index
List
of Figures
Returns
the BluetoothAddress of the terminal using this session.
List of Tables
List
of Listings
boolean
isSessionActive(long sessionType)
List of Sidebars
Tells whether the indicated session type is active.
java.lang.String toString()
Implements the toString method.
Bluetooth for Java
Class NoSuchSessionException
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
public class NoSuchSessionException extends java.lang.RuntimeException
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Thrown by a BlipNodeHandle
to indicate that an attempt was made to close a non-existing session.
Bluetooth-based services, highlights of security concerns, and
more.
//Package
com.ericsson.blipnet.api.blipnode
Table of Contents
Bluetooth for Java
//Constructors
Introduction
NoSuchSessionException()
Chapter
1 - Introducing Bluetooth
NoSuchSessionException(java.lang.String
message)
Chapter
2 - Bluetooth 1.1
NoSuchSessionException(java.lang.String
message,
Chapter
3 - Before You Get Started
java.lang.Throwable
cause)
Chapter
4 - Understanding the Java Bluetooth API
NoSuchSessionException(java.lang.Throwable
cause)
Chapter 5 - Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
Interface ObexEvent
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
public interface ObexEvent extends Event
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
An event indicating
that an OBEX-related action has occurred in the BlipServer.
Bluetooth-based services, highlights of security concerns, and
more.
//Package
com.ericsson.blipnet.api.event
Table of Contents
Bluetooth for Java
//Methods
Introduction
boolean equals(java.lang.Object obj)
Chapter 1 - Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Returns3 true
if content
of object
is equal to this.
Chapter
- Before
You Get
Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter
5 - Bluetooth with
J2ME MIDP
java.lang.String
getMimeType()
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Returns8 the
mime-type
of theSimulator
OBEX object to which this event is related.
Chapter
- Using
a Bluetooth
Chapter 9
- Bluetooth Security
int getObexResponseCode()
Chapter
10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Returns the OBEX Response Code associated with this event (if any).
Appendix A - javax.bluetooth
Appendix B - javax.obex
java.io.File getPath()
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
Returns the path of the file to which this event is related.
List of Figures
List of Tables
BluetoothAddress getTerminalID()
List of Listings
List of Sidebars
Returns the Bluetooth device address of the terminal to which this event is related.
Bluetooth for Java
Class ObexFile
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
public final class ObexFile extends java.lang.Object implements
The authors of this text describe how to develop wireless Java
ObexPushObject
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
Implements an OBEX
more.push object containing a file.
//Package
com.ericsson.blipnet.api.obex.pushobjects
Table of Contents
Bluetooth for Java
Introduction
//Constructors
Chapter
1 - Introducing Bluetooth
ObexFile(java.io.File
file)
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Constructs
OBEX pushthe
object
Chapter
4 - an
Understanding
Javarepresenting
Bluetooth APIthe specified file.
Chapter 5
- Bluetooth with J2ME MIDP
Chapter
ObexFile(java.io.File
6 - Creating a Bluetoothfile,
Print Server
byte[]
with b)
JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Constructs- an
OBEX push object containing the bytes of the specified byte[] and with the specified
Bluetooth Security
filename.
Chapter 9
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
//Methods
Chapter
12 - Bluetooth and Jini
java.lang.String getAbsoluteFileName()
byte[] getObexBody()
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix
- BlipNet
Returns Dthe
body of1.1
thisAPI
ObexPushObject.
Index
List of Figures
java.lang.String getObexName()
List of Tables
List of Listings
Returns
the name of this ObexPushObject.
List
of Sidebars
java.lang.String getObexType()
Returns the mime-type of this ObexPushObject.
void setObexType(java.lang.String mimeType)
Bluetooth for Java
Class ObexGenericObject
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
public class ObexGenericObject extends java.lang.Object implements
The authors of this text describe how to develop wireless Java
ObexPushObject
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
Implements a generic
more.OBEX push object.
//Package
com.ericsson.blipnet.api.obex.pushobjects
Table of Contents
Bluetooth for Java
Introduction
//Constructors
Chapter
1 - Introducing Bluetooth bytes)
ObexGenericObject(byte[]
Chapter 2 - Bluetooth 1.1
Chapter 3
- Before You Get Started
Constructs
OBEX pushthe
object
Chapter
4 - an
Understanding
Javarepresenting
Bluetooth APIthe specified file.
Chapter 5
- Bluetooth with J2ME MIDP
Chapter
ObexGenericObject(byte[]
6 - Creating a Bluetooth Print
bytes,
Server with
java.lang.String
JPS API
obexType)
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Constructs- an
OBEX push object containing the bytes of the specified byte[] and with the specified
Bluetooth Security
filename.
Chapter 9
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
ObexGenericObject(java.lang.String
obexName, byte[] bytes)
Chapter
12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Constructs an OBEX push object containing the bytes of the specified byte[] and with the specified
Appendix
C - Java Bluetooth Development on the PalmOS Platform
filename.
Appendix D - BlipNet 1.1 API
Index
ObexGenericObject(java.lang.String obexName, byte[] bytes,
java.lang.String obexType)
List of Figures
List of Tables
List of Listings
List
Constructs
of Sidebars
an OBEX push object containing the bytes of the specified byte[] and with the specified
filename.
//Methods
byte[] getObexBody()
Returns the body of this ObexPushObject.
java.lang.String getObexName()
Returns the name of this ObexPushObject.
java.lang.String getObexType()
Returns the mime-type of this ObexPushObject.
void setObexType(java.lang.String mimeType)
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
Interface ObexProgressEvent
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
public interface ObexProgressEvent extends Event
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
An event indicating
progress of an ongoing OBEX push. This type of event is only sent to
Bluetooth-based services, highlights of security concerns, and
ObexProgressListeners.
more.
//Package
com.ericsson.blipnet.api.event
Table of Contents
Bluetooth for Java
Introduction
//Methods
Chapter
1 -equals(java.lang.Object
Introducing Bluetooth
boolean
obj)
Chapter 2 - Bluetooth 1.1
Chapter 3
- Before You Get Started
Returns4 true
if content of object
is equal
to this.
Chapter
- Understanding
the Java
Bluetooth
API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter
int getBytesCompleted()
6 - Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Returns the
number of bytes received so far.
- Bluetooth Security
Chapter 9
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
java.lang.String
getObexName()
Chapter
11 - Enterprise Bluetooth
Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Returns the name of the OBEX object to which this event is related.
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
int getObjectSize()
Appendix D - BlipNet 1.1 API
Index
List
of Figures
Returns
the total size of the object to which this event is related.
List of Tables
List
of Listings
BluetoothAddress
getTerminalID()
List of Sidebars
Returns the Bluetooth device address of the terminal to which this event is related.
int hashCode()
Bluetooth for Java
Interface ObexProgressListener
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
public interface ObexProgressListener
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
This abstract class
should be extended to create an event listener for listening to ObexProgressEvents
Bluetooth-based services, highlights of security concerns, and
while pushing content
more.to a terminal.
//Package
com.ericsson.blipnet.api.event
Table of Contents
Bluetooth for Java
Introduction
//Methods
Chapter
1 - Introducing Bluetooth
void newProgress(ObexProgressEvent
e)
Chapter 2 - Bluetooth 1.1
Chapter 3
- Before You Get Started
This method
is called by the
whenever
Chapter
4 - Understanding
theBlipServer
Java Bluetooth
API new push progress information is available.
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
Interface ObexPushObject
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
public interface ObexPushObject extends java.io.Serializable
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
TheObexPushObject
class defines a common interface for OBEX objects which are going to be pushed
Bluetooth-based services, highlights of security concerns, and
to a terminal.
more.
//Package
com.ericsson.blipnet.api.obex.pushobjects
Table of Contents
Bluetooth for Java
Introduction
//Methods
Chapter
1 getObexBody()
- Introducing Bluetooth
byte[]
Chapter 2 - Bluetooth 1.1
Chapter 3
- Before You Get Started
Returns4 the
body of this ObexPushObject.
Chapter
- Understanding
the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter
java.lang.String
6 - Creating a Bluetooth
getObexName()
Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Returns the name of this ObexPushObject.
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
java.lang.String
getObexType()
Chapter
11 - Enterprise Bluetooth
Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Returns the mime-type of this ObexPushObject.
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
Class ObexServerHostedFile
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
public final class ObexServerHostedFile extends java.lang.Object
The authors of this text describe how to develop wireless Java
implements ObexPushObject
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
AnObexServerHostedFile
is an OBEX push object which will be read from the server's local storage
more.
when the object is pushed to a terminal. The advantage of a server hosted file compared to a regular
ObexFile is that the contents of the file are not transferred across the network when pushing the file. This
Table
mayof
beContents
desirable when pushing very large objects.
Bluetooth for Java
Introduction
//Package
Chapter
1 - Introducing Bluetooth
com.ericsson.blipnet.api.obex.pushobjects
Chapter 2
- Bluetooth 1.1
Chapter
3 - Before You Get Started
//Constructors
Chapter
4 - Understanding the Java Bluetooth APIfile)
ObexServerHostedFile(java.io.File
Chapter
ObexServerHostedFile(java.io.File
5 - Bluetooth with J2ME MIDP
file, java.lang.String obexType)
Chapter 6
- Creating a Bluetooth Print Server with JPS API
//Methods
Chapter
7 - Java and OBEX
boolean
Chapter
8 -fileExists()
Using a Bluetooth Simulator
java.io.File
getFileDescriptor()
Chapter
9 - Bluetooth
Security
byte[]
Chapter
10 getObexBody()
- Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter
- Bluetooth
andObexPushObject.
Jini
Returns12the
body of this
Appendix A - javax.bluetooth
Appendix B - javax.obex
java.lang.String getObexName()
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
Returns the name of this ObexPushObject.
List of Figures
List
of Tables
java.lang.String
getObexType()
List of Listings
List of Sidebars
Returns the mime-type of this ObexPushObject.
Bluetooth for Java
Interface PageData
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
public interface PageData extends java.io.Serializable
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
APageData object
contains all data needed to do a link establishment after an inquiry. Using the data in
Bluetooth-based services, highlights of security concerns, and
this object, link establishment
time will be shortened. Used when BlipNode is in INQUIRY RESULT mode
more.
and the application does the link establishment via the BlipServer API.
Table of Contents
//Package
com.ericsson.blipnet.api.bluetooth
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
Interface RemoteBlipServerEventListener
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
public interface RemoteBlipServerEventListener extends java.rmi.Remote
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Defines the handle
Event method for notifying event listeners of BlipServer events. The interface is used
Bluetooth-based services, highlights of security concerns, and
internally by the BlipServer
API, and should never be implemented by client applications.
more.
//Package
com.ericsson.blipnet.api.event
Table of Contents
Bluetooth for Java
Introduction
//Methods
Chapter
1 - Introducing Bluetoothevent)
void handleEvent(Event
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
Interface RemoteObexProgressListener
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
public interface RemoteObexProgressListener extends java.rmi.Remote
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Defines the newProgress
method for notifying event listeners of Push progress events. The interface is
Bluetooth-based services, highlights of security concerns, and
used internally bymore.
the BlipServer API, and should never be implemented by client applications.
//Package
com.ericsson.blipnet.api.event
Table of Contents
Bluetooth for Java
Introduction
//Methods
Chapter
1 - Introducing Bluetooth
void newProgress(ObexProgressEvent
e)
Chapter 2 - Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
Class ScanMode
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
public final class ScanMode extends java.lang.Object implements
The authors of this text describe how to develop wireless Java
java.io.Serializable
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
TheScanMode class
encapsulates the different Scan Modes supported by the BlipNode.
more.
//Package
com.ericsson.blipnet.api.Bluetooth
Table of Contents
Bluetooth for Java
Introduction
//Fields
Chapter
1 java.lang.String[]
- Introducing Bluetooth
static
FRIENDLY_NAMES
Chapter 2 - Bluetooth 1.1
Chapter 3
- Before You Get Started
Friendly4 names
of the defined
ScanBluetooth
Modes. API
Chapter
- Understanding
the Java
Chapter 5
- Bluetooth with J2ME MIDP
Chapter
static
6 int
- Creating
INQUIRY_AND_PAGE_SCAN_DISABLED
a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Inquiry Scan:
Disabled, Page Scan: Disabled.
- Bluetooth Security
Chapter 9
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
static
INQUIRY_AND_PAGE_SCAN_ENABLED
Chapter
11 int
- Enterprise
Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Inquiry Scan: Enabled, Page Scan: Enabled.
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
static int INQUIRY_SCAN_ENABLED
Appendix D - BlipNet 1.1 API
Index
List
of Figures
Inquiry
Scan: Enabled, Page Scan: Disabled.
List of Tables
List
of Listings
static
int PAGE_SCAN_ENABLED
List of Sidebars
Inquiry Scan: Disabled, Page Scan: Enabled.
//Constructors
ScanMode(int value)
Constructs a ScanMode object representing a valid Scan Mode.
//Methods
boolean equals(java.lang.Object obj)
int getScanMode()
Returns the scan mode represented by this object.
int hashCode()
java.lang.String toString()
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
Class Session
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
public final class Session extends java.lang.Object implements
The authors of this text describe how to develop wireless Java
java.io.Serializable
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
TheSession class
encapsulates the session types supported by the BlipServer.
more.
//Package
com.ericsson.blipnet.api.Bluetooth
Table of Contents
Bluetooth for Java
Introduction
//Fields
Chapter
1 java.lang.String[]
- Introducing Bluetooth
static
FRIENDLY_NAMES
Chapter 2 - Bluetooth 1.1
Chapter 3
- Before You Get Started
Friendly4 names
of the defined
session
types.API
Chapter
- Understanding
the Java
Bluetooth
Chapter 5
- Bluetooth with J2ME MIDP
Chapter
static
6 long
- Creating
LAP_CLIENT
a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
LAN Access
Profile (LAP) Client session type.
- Bluetooth Security
Chapter 9
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
static
LAP_SERVER
Chapter
11 long
- Enterprise
Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
LAN Access Profile (LAP) Server session type.
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
static long OPP_CLIENT
Appendix D - BlipNet 1.1 API
Index
List
of Figures
Object
Push Profile (OPP) Client session type.
List of Tables
List
of Listings
static
long OPP_SERVER
List of Sidebars
Object Push Profile (OPP) Server session type.
//Constructors
Session(long sessionType)
Constructs a Session object representing the specified session type.
//Methods
boolean equals(java.lang.Object obj)
long getSessionType()
Returns the type of this Session object.
int hashCode()
java.lang.String toString()
Bluetooth for Java
Class ShortUuid
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
public final class ShortUuid extends java.lang.Object implements
The authors of this text describe how to develop wireless Java
java.io.Serializable
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
TheShortUuid more.
class models a Bluetooth universal unique identifier. This is a 16 bit unsigned integer,
often written in hexadecimal.
Objects
of the ShortUuid class are immutable—once created they cannot change.
Table
of Contents
Bluetooth for Java
This class provides the equals and hashCode methods for use in connection with the Collection classes.
Introduction
Chapter 1
- Introducing Bluetooth
//Package
Chapter
2 - Bluetooth 1.1
com.ericsson.blipnet.api.bluetooth
Chapter 3 - Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
//Fields
- Bluetooth with J2ME MIDP
static int DIALUP_NETWORKING_SERVICE_CLASS_ID
Chapter 5
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter
8 - Using
Bluetooth
SimulatorProfile.
Short UUID
for thea Dialup
Networking
Chapter 9
- Bluetooth Security
Chapter
10 int
- Wireless
Embedded Systems with the Micro BlueTarget
static
LAN_ACCESS_USING_PPP_SERVICE_CLASS_ID
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Short UUID
for the LAN Access Using PPP Profile.
Appendix
A - javax.bluetooth
Appendix B - javax.obex
Appendix
staticC int
- JavaOBEX_OBJECT_PUSH_SERVICE_CLASS_ID
Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
Short UUID for the OPP Profile.
List of Figures
List of Tables
static
int SERIAL_PORT_SERVICE_CLASS_ID
List
of Listings
List of Sidebars
Short UUID for the Serial Port Profile.
static int SERVICE_DISCOVERY_SERVER_SERVICE_CLASS_ID
Short UUID for the Service Discovery Server Profile.
static int WAP_OVER_BLUETOOTH_CLIENT_SERVICE_CLASS_ID
Short UUID for the WAP over Bluetooth Client.
static int WAP_OVER_BLUETOOTH_SERVER_SERVICE_CLASS_ID
Short UUID for the WAP over Bluetooth Server.
//Constructors
ShortUuid(byte[] shortUuid)
Constructs a ShortUuid
object from a byte[].
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
ShortUuid(intApress
shortUuid)
© 2003 (352 pages)
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
Constructs a ShortUuid
object
from an of
int.the Java library, development of
includes an
API overview
Bluetooth-based services, highlights of security concerns, and
more.
ShortUuid(java.lang.String shortUuid)
Table of Contents
Constructs a ShortUuid object from a String.
Bluetooth for Java
Introduction
//Methods
Chapter
1 - Introducing Bluetooth
boolean
obj)
Chapter
2 -equals(java.lang.Object
Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
Understanding the Java Bluetooth API
Compares- this
ShortUuid with an Object and returns true if they are equal.
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
byte[] getBytes()
Chapter
- Bluetooth
Security
Returns9 the
byte representation
of this ShortUuid object.
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter
11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
int getInt()
Chapter
12 - Bluetooth and Jini
int hashCode()
Appendix A - javax.bluetooth
Appendix B - javax.obex
Returns Ca -hashCode
for this
ShortUuid.
Appendix
Java Bluetooth
Development
on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
java.lang.String toString()
List of Figures
List of Tables
Returns a String representation of this ShortUuid.
List of Listings
List of Sidebars
java.lang.String toString4MalSignal()
Bluetooth for Java
Class TerminalNotConnectedException
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
public class TerminalNotConnectedException extends
The authors of this text describe how to develop wireless Java
java.lang.RuntimeException
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
Thrown by a BlipNodeHandle
when a request for action is made towards a terminal which is not
more.
connected.
Table of Contents
//Package
com.ericsson.blipnet.api.blipnode
Bluetooth for Java
Introduction
Chapter
1 - Introducing Bluetooth
//Constructors
Chapter
2 - Bluetooth 1.1
TerminalNotConnectedException()
Chapter
3 - Before You Get Started
TerminalNotConnectedException(java.lang.String
message)
Chapter
4 - Understanding the Java Bluetooth API
TerminalNotConnectedException(java.lang.String
message,
Chapter
java.lang.Throwable
5 - Bluetooth with J2ME
cause)
MIDP
TerminalNotConnectedException(java.lang.Throwable
cause)
Chapter
6 - Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
Class WapServiceIndication
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
public final class WapServiceIndication extends java.lang.Object implements
The authors
of this text describe how to develop wireless Java
ObexPushObject,
java.io.Serializable
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
TheWapServiceIndication
class models the WAP Service Indication. This service provides the ability
more.
to send notifications to end-users in an asynchronous manner. Such notifications may, for example, be
about new e-mails, changes in stock prices, news headlines, advertising, reminders of, for example, low
Table
of Contents
prepaid
balance, and so forth.
Bluetooth for Java
The WAP Service Indication contains a short message and a URI indicating a service. The message is
Introduction
presented
the end-user
upon reception, and the user is given the choice to either start the service
Chapter
1 -toIntroducing
Bluetooth
indicated
the URI immediately,
or postpone the Service Indication for later handling. If the Service
Chapter
2 by
- Bluetooth
1.1
Indication is
postponed, the client stores it and the end-user is given the possibility to act upon it at a later
- Before You Get Started
point of time.
Chapter 3
Chapter 4
- Understanding the Java Bluetooth API
Chapter
Bluetooth
with J2ME MIDP
Objects5 of-the
WapServiceIndication
class are immutable—once created they cannot change.
Chapter 6 - Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
//Package
Chapter
8 - Using a Bluetooth Simulator
com.ericsson.blipnet.api.obex.pushobjects
Chapter
9 - Bluetooth Security
//Fields
Chapter
10 byte
- Wireless
Embedded Systems with the Micro BlueTarget
static
DELETE
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
The WAP
Indication(s) received on the terminal with a given ID must be deleted.
Appendix
A -Service
javax.bluetooth
Appendix B - javax.obex
staticC byte
Appendix
- Java SIGNAL_HIGH
Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
Indicates that the WAP Service Indication must be presented as soon as the implementation (of the
terminal) allows that to be carried out in a non-user-intrusive manner, or earlier if considered appropriate
List of Tables
(which may result in a user-intrusive behavior).
List of Figures
List of Listings
List of Sidebars
static byte SIGNAL_LOW
Indicates that the WAP Service Indication must be postponed without user intervention.
static byte SIGNAL_MEDIUM
Indicates that WAP Service Indication must be presented as soon as the implementation allows that to be
carried out in a non-user-intrusive manner.
static java.lang.String TOKENIZED_MEDIA_TYPE
Defines the tokenized form of the WAP Service Indication Media Type.
//Constructors
WapServiceIndication (java.lang.String uri, java.lang.String id,
byte action, java.lang.String contents)
Constructs a WapServiceIndication.
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
WapServiceIndication(java.lang.String uri, java.lang.String id,
Apress © 2003 (352 pages)
java.lang.String contents)
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Constructs a WapServiceIndication.
Bluetooth-based services, highlights of security concerns, and
more.
WapServiceIndication(java.lang.String uri, java.lang.String id,
java.lang.String expires, byte action, java.lang.String contents)
Table of Contents
Bluetooth for Java
Introduction
Constructs a WapServiceIndication.
Chapter 1 - Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
WapServiceIndication(java.lang.String uri, java.lang.String id,
- Before You Get Started
java.lang.String
expires, java.lang.String contents)
Chapter 3
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Constructs
WapServiceIndication.
Chapter
6 - aCreating
a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter
8 - Using a Bluetooth Simulator
//Methods
Chapter
9 -equals(java.lang.Object
Bluetooth Security
boolean
obj)
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Compares this WapServiceIndication with an Object and returns true if they are equal.
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
byte[]B getObexBody()
Appendix
- javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Returns the body of this ObexPushObject.
Index
List of Figures
java.lang.String getObexName()
List of Tables
List of Listings
List
of Sidebars
Returns
the name of this ObexPushObject.
java.lang.String getObexType()
Returns the mime-type of this ObexPushObject.
int hashCode()
Returns a hashCode for this WapServiceIndication.
java.lang.String toString()
Returns a String representation of this WapServiceIndication.
Bluetooth for Java
Class WapServiceLoading
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
public final class WapServiceLoading extends java.lang.Object implements
The authors
of this text describe how to develop wireless Java
ObexPushObject,
java.io.Serializable
applications using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
TheWapServiceLoading
class models the WAP Service Loading. This service provides the ability to
more.
cause a user agent on a terminal to load and execute a service, that, for example, can be in the form of a
WML deck. The Service Loading contains an URI indicating the service to be loaded by the user agent
Table
of Contents
without
user intervention when appropriate.
Bluetooth for Java
Objects of the WapServiceLoading class are immutable—once created they cannot change.
Introduction
Chapter 1
- Introducing Bluetooth
//Package
Chapter
2 - Bluetooth 1.1
com.ericsson.blipnet.api.obex.pushobjects
Chapter
3 - Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
//Fields
Chapter
5 - Bluetooth with J2ME MIDP
static
CACHE
Chapter
6 byte
- Creating
a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Indicates that
the WAP service content is loaded in the same way as for EXECUTE-LOW, but instead of
Chapter
9 -the
Bluetooth
executing
service Security
in the same way as for EXECUTE-LOW it is placed in the cache of the client.
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
static byte EXECUTE_HIGH
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix
- javax.obex
IndicatesB that
the WAP service content is loaded and executed in the same way as for EXECUTE-LOW
Appendix
but mayCresult
- Java
inBluetooth
an user-intrusive
Development
behavior.
on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
static byte EXECUTE_LOW
List of Figures
List of Tables
Indicates
that the WAP service content is fetched from either an origin server or from the client's cache, if
List
of Listings
available.
List
of Sidebars
static java.lang.String TOKENIZED_MEDIA_TYPE
Defines the tokenized form of the WAP Service Loading Media Type.
//Constructors
WapServiceLoading(java.lang.String uri)
Constructs a WapServiceLoading.
WapServiceLoading(java.lang.String uri, byte action)
Constructs a WapServiceLoading.
//Methods
boolean equals(java.lang.Object obj)
Compares this WapServiceLoading with an Object and returns true if they are equal.
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
byte[] getObexBody()
ISBN:1590590783
The authors of this text describe how to develop wireless Java
using Bluetooth for a variety of platforms. This
Returns the bodyapplications
of this ObexPushObject.
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more. getObexName()
java.lang.String
Table of Contents
Returns the name of this ObexPushObject.
Bluetooth for Java
Introduction
java.lang.String getObexType()
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter
- Before
You Get
Started
Returns3 the
mime-type
of this
ObexPushObject.
Chapter 4
- Understanding the Java Bluetooth API
Chapter
5 - Bluetooth with J2ME MIDP
int hashCode()
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Returns8 a -hashCode
for this Simulator
WapServiceLoading.
Chapter
Using a Bluetooth
Chapter 9
- Bluetooth Security
Chapter
10 - Wireless Embedded
Systems with the Micro BlueTarget
java.lang.String
toString()
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Returns a String representation of this WapServiceLoading.
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Index
Numbers
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
1-Wire (Dallas Semiconductor),
254–255
includes an API overview of the Java library, development of
Bluetooth-based
services, highlights of security concerns, and
1-Wire interface, 254
more.
1-Wire sensor/controller, 255
2.4 GHz frequency band, 1
Table of Contents
3Com USB Bluetooth module, 14
Bluetooth for Java
3Com Wireless Bluetooth Printer Adapter, 97
Introduction
Chapter
802.11b,
1 vs.
- Introducing
Bluetooth, Bluetooth
1–3
Chapter
2 encryption
- Bluetoothkey,
1.1160–161
1024-bit
Chapter 3 - Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Index
A
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
using Bluetooth for a variety of platforms. This
AcceptAndOpen()applications
method, 127
includes an API overview of the Java library, development of
Bluetooth-based
Add New Slave dialog
box, 177 services, highlights of security concerns, and
more.
AddEventListener() method, 234–235
Adopted protocols, explained, 20
Table of Contents
Airports,226
Bluetooth for Java
All-Bluetooth Jini federation, 252–254
Introduction
Chapter
Antennae
1 -on
Introducing
HP iPAQ 5400
Bluetooth
series Pocket PC, 4
Chapter
- Bluetooth
1.1141
Apache2 Ant
build utility,
Chapter 3
- Before You Get Started
Application development with Micro BlueTarget, 187–224
Chapter 4
- Understanding the Java Bluetooth API
Application
78 J2ME MIDP
Chapter
5 - manager,
Bluetooth with
Arcade,6 in-restaurant
9 Print Server with JPS API
Chapter
Creating a lobby,
Bluetooth
Chapter
7 - Java
and OBEX159
Asymmetrical
encryption,
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Asynchronous event handler, 187
Atinav Bluetooth SDK, 47,83,105
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Atinav SDK
stack initialization
code,
47
Chapter
11 - Enterprise
Bluetooth
Applications
with the Ericsson BlipNet
Chapter
12 -ofBluetooth
and Jini 59–60
Attributes,
service records,
Appendix A - javax.bluetooth
Authenticate parameter of connection URL, 156–157,162
Appendix B - javax.obex
Authentication,156–158,173
with LAN access point, 192
Appendix D - BlipNet 1.1 API
over L2CAP connection, 163
Appendix C - Java Bluetooth Development on the PalmOS Platform
Index
Authentication
List
of Figures request (client), 157
Authentication
request (server), 156
List
of Tables
List
of Listings interface (javax.obex), 265
Authenticator
List of Sidebars
Authorization (Bluetooth server), 158–159,163
Authorization over L2CAP connection,163
Authorize parameter of connection URL String, 158
Authorize() method of RemoteDevice class, 158
Index
B
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
Bank account information
(listing), 160
includes an API overview of the Java library, development of
Bluetooth-based
services,
highlights
Bank account information encrypted
(listing),
161 of security concerns, and
more.
Baseband controller (Bluetooth), 183
Basic Imaging Profile, 28
Table of Contents
Basic Printing Profile, 28
Bluetooth for Java
BCC (Bluetooth Control Center), 46,191
Introduction
Chapter
BeamTsk.java
1 - Introducing
listing, 87–88
Bluetooth
Chapter
2 King
- Bluetooth
1.1Denmark, 11
Blatand,
Harald of
Chapter 3 - Before You Get Started
BlipManager application, 231–232
Chapter 4
- Understanding the Java Bluetooth API
BlipNet,5226–232
Chapter
- Bluetooth with J2ME MIDP
accessing
external resources, 228
- Creating a Bluetooth Print Server with JPS API
architecture,227–232
Chapter 7 - Java and OBEX
architecture diagram, 227
Chapter 8 - Using a Bluetooth Simulator
BlipManager application, 231–232
Chapter 9 - Bluetooth Security
BlipNodes,229–230
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
BlipServer,227–228
Chapter 6
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
BlipNet API overview, 232–233
Chapter 12 - Bluetooth and Jini
BlipNet packages,
232–233
Appendix
A - javax.bluetooth
Appendix
B - javax.obex
BlipNetIcons
class, 233
Appendix
- Java Bluetooth
BlipNodeC installation,
230 Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
BlipNode unit, 230
Index
BlipNodes
(BlipNet), 229–230
List
of Figures
List
BlipServer
of Tables(BlipNet), 227–228
List
of Listings
BlipServerConnection
class, 234
List of Sidebars
BlipServerEventAdapter class, 235
BlipServerEventFilter class, 234–235
BlipServerEventListener class, 235
BlueCore 01b (CSR), 183
Bluetooth
vs. 802.11b, 1–3
as cable replacement technology, 2
as a low-power wireless technology, 2
as a wireless communication protocol, 1
basic components of, 45–72,241
client-server architecture, 1
deployment locations, 226
history of, 11–12
vs. infrared, 1
integrating with Java, 33–43
integrating with Jini, 252–256
integrating with JPS, 104–112
with J2ME MIDP, 75–96
nominal range, 1
omnidirectional transmissions, 1
on PalmOS platform, 269–272
for Java
in small officeBluetooth
or home office,
6
ISBN:1590590783
by
Bruce
Hopkins
and Ranjith Antony
for voice applications, 6–7
Apress
©
2003
(352
pages)
when not to use with Java, 33–34
The authors
of this text describe how to develop wireless Java
for wireless gaming,
7
applications using Bluetooth for a variety of platforms. This
in your car, 7–8
includes an API overview of the Java library, development of
Bluetooth-based
services,52
highlights of security concerns, and
Bluetooth Assigned
Numbers document,
more.
Bluetooth-certified product, explained, 31
Bluetooth compliance, explained, 22
Table of Contents
Bluetooth device tracker, 233–240
Bluetooth for Java
Bluetooth devices, 13–15,40–41
Introduction
authentication
of, 156
Chapter
1 - Introducing
Bluetooth
classes- of,
225
Bluetooth 1.1
connection capabilities of, 15–16
Chapter 3 - Before You Get Started
creating in Impronto Simulator, 142
Chapter 4 - Understanding the Java Bluetooth API
of the future, 8–9
Chapter 5 - Bluetooth with J2ME MIDP
on the market today, 3–7
Chapter 6 - Creating a Bluetooth Print Server with JPS API
power classes, 16–17
Chapter
- Java
and OBEX
TDK7 USB,
83–84
Chapter
- Using
Bluetooth
that8beep
until afound,
8 Simulator
Chapter 2
Chapter 9
- Bluetooth Security
Bluetooth devices in the area, browsing, 90
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Bluetooth
modes,
52 Applications with the Ericsson BlipNet
Chapter
11 discovery
- Enterprise
Bluetooth
Bluetooth
41 and Jini
Chapter
12 host,
- Bluetooth
Appendix
A Print
- javax.bluetooth
Bluetooth
Server, creating with JPS API, 97–113
Appendix B - javax.obex
Bluetooth printer adapter, 97
Appendix C - Java Bluetooth Development on the PalmOS Platform
Bluetooth profiles, 23–28
vs. J2
Index
ME profiles, 29–30
List of Figures
OBEX to implement, 116
List of Tables
TCP/IP-based,253
List of Listings
UUID values for, 62
Appendix D - BlipNet 1.1 API
List of Sidebars
Bluetooth Protocol Analyzer, 163,173–178
Bluetooth protocol stack, 17–23
Bluetooth protocol stack layers, 18–20,23
Bluetooth protocols to send and receive data, 115
Bluetooth Qualification Body, 31
Bluetooth qualification process, 31–32
Bluetooth Qualification Web site, 32
Bluetooth radios, 13.See also Bluetooth devices
Bluetooth security. SeeSecurity
Bluetooth server
authentication, 156–157
authorization,158–159
connections with Serial Port Profile, 68–69
encryption,161–162
Bluetooth Service, explained, 191
Bluetooth SIG promoter companies, 12
Bluetooth (network) simulator, 137–153
Bluetooth Special Interest Group (SIG), 11–12
Bluetooth for Java
Bluetooth specifications
page, 23
by Bruce Hopkins and Ranjith Antony
Bluetooth stack, 41,
47–51
Apress
© 2003 (352 pages)
ISBN:1590590783
The authors 47–51
of this text describe how to develop wireless Java
Bluetooth stack initialization,
applications using Bluetooth for a variety of platforms. This
Bluetooth versionincludes
1.1, 11–32
an API overview of the Java library, development of
Bluetooth-based
services,
of security concerns, and
BluetoothConnectionException class,
156,highlights
158,162,259
more.
BluetoothSetup1.java listing, 47–48
BluetoothStateException class, 259
Table of Contents
BNEP (Bluetooth
Bluetooth
for Java Network Encapsulation Protocol), 22, 252
Introduction
Bootloader section (ROM), 188
Chapter
1 - Introducing
BTAUTOLAN.CFG
file, Bluetooth
192
Chapter 2
- Bluetooth 1.1
Btgoep protocol, 128
Chapter 3
- Before You Get Started
Building,
employees
229
Chapter
4 tracking
- Understanding
the in,
Java
Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Index
C
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
C/Cbased Bluetooth
SDK, 39
includes an API overview of the Java library, development of
Bluetooth-based
services, 21,
highlights
of security
concerns, and
Cable replacement protocol (RFCOMM),
25,67–70,
72
more.
Cable replacement technology, Bluetooth as, 2,5
CACHED device, explained, 56–57
Table of Contents
Car, Bluetooth in, 7–8
Bluetooth for Java
CAST algorithm, 160–161
Introduction
Chapter
CDC (connected
1 - Introducing
deviceBluetooth
configuration), 75
Chapter
2 - Bluetooth 1.1
Cell phones
Chapter
3 - Before
You Get Started
configuring
in Impronto
Simulator, 143
Chapter
- Understanding
the Java 5
Bluetooth API
and4laptop
connection sharing,
Chapter
5 - Bluetooth
limitations
of, 3 with J2ME MIDP
Chapter
and6PDA
- Creating
data transfer,
a Bluetooth
3–4 Print Server with JPS API
Chapter
7 - Java
and OBEX
Centralized
communication,
226
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Challenge/response mechanism, 156
Chat example,
145–152
Chapter
10 - Wireless
Embedded Systems with the Micro BlueTarget
ChatClient.java
listing,Bluetooth
146–150 Applications with the Ericsson BlipNet
Chapter
11 - Enterprise
Chapter
12 - Bluetooth
Jini 151
ChatServer
Bluetoothand
device,
Appendix A - javax.bluetooth
ChatServer conversation, 152
Appendix B - javax.obex
ChatServer interacting with ChatClient, 151
Appendix C - Java Bluetooth Development on the PalmOS Platform
ChatServer.java
listing,
145–146
Appendix
D - BlipNet
1.1 API
Index
Cipher (encryption algorithm), 159
List of Figures
Class 1 Bluetooth devices, 17,225
List of Tables
Class 2 or Class 3 Bluetooth devices, 17,225
List of Listings
CLDC
(connected limited device configuration), 75–76,186
List
of Sidebars
CLDC packages for small device Java applications, 76
CLDC Technology Compatibility Kit (TCK), 186
Client authentication, 157
Client authentication request, 157
Client connections with Serial Port Profile, 69–70
Client encryption, 162–163
Client-server architecture (Bluetooth), 1
ClientApp.java listing, 165–170
ClientSession interface (javax.obex),122,265
ClientSession object
connect() method, 131
createHeaderSet() method, 122
disconnect() method, 132
setPath() method, 135
Com.ericsson.blipnet.api packages, 232–233
Communication, 67–72
multipoint,16
point-to-point, 15
Bluetooth for Java
CONNECT operation
(OBEX), 121,131
by Bruce Hopkins and Ranjith Antony
Connect() method
of ClientSession
object, 131
Apress
© 2003 (352 pages)
ISBN:1590590783
authors of this text describe
how to develop wireless Java
Connection classThe
(javax.microedition.io),
122
applications using Bluetooth for a variety of platforms. This
Connection sharing,
laptop
phone,
5 of the Java library, development of
includes
anto
API
overview
Bluetooth-based
services,
highlights of security concerns, and
Connection URL String, 128
more.
authenticate parameter, 156–157,162
authorize parameter, 158
parameter, 161–162,174,177
Tableencrypt
of Contents
and
the
130
Bluetooth for SDDB,
Java
Introduction
Connections
Chapter
Bluetooth
1 - Introducing
device, 15–16
Bluetooth
defined,
Chapter
2 - 68
Bluetooth 1.1
and3sessions,
Chapter
- Before68
You Get Started
Chapter
4 - class,
Understanding
the Java Bluetooth API
Connector
66
Chapter 5
Bluetooth with J2ME MIDP
Connector- object
open() method, 64,69,80,130
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
ConnectToClientAndPrint() method, 105
CONTINUE
response
code (OBEX),
121,125
Chapter
8 - Using
a Bluetooth
Simulator
Chapter
9 - See
Bluetooth
Security
Controllers.
Bluetooth
devices
Chapter
10 phone
- Wireless
Embedded
Systems
with the Micro BlueTarget
Cordless
(Bluetooth),
21,
27
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Cordless Telephony Profile, 27
Chapter 12 - Bluetooth and Jini
CPU gate
183
Appendix
A -count,
javax.bluetooth
Appendix
CREATE-EMPTY
B - javax.obex
operation (OBEX), 123
Appendix
C - Java Bluetooth
Development
on the PalmOS Platform
CreateHeaderSet()
method,
122
Appendix D - BlipNet 1.1 API
CreatePrintJob() method, 101
Index
CSR
baseband controller, 187
List
of Figures
CSR
BlueCore 1 radio, 14
List
of Tables
List of Listings
List of Sidebars
Index
D
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
Data format, identifying
with JPS, 100
includes an API overview of the Java library, development of
Bluetooth-based
services, highlights of security concerns, and
Data security. SeeSecurity
more.
Data terminal authentication, 192
DataElement class (javax.bluetooth), 59–60,65,260
Table of Contents
Debugging, with Bluetooth simulator, 137–153
Bluetooth for Java
Decryption,177–178
Introduction
Chapter
Deployment
1 - Introducing
locations for
Bluetooth
Bluetooth applications, 226
Chapter
2 - Bluetooth
1.1 setup checklist, 81
Development
environment
Chapter 3 - Before You Get Started
Device classes, Bluetooth major and minor, 54–55
Chapter 4
- Understanding the Java Bluetooth API
Device 5communication
types
Chapter
- Bluetooth with
J2ME MIDP
multipoint,
16
- Creating a Bluetooth Print Server with JPS API
point-to-point, 15
Chapter 6
Chapter 7
- Java and OBEX
Device 8discovery,
Chapter
- Using a55–57
Bluetooth Simulator
Chapter
- Bluetooth
Security
Device 9driver,
17
Chapter
- Wireless Embedded
Device 10
management,
25,51–55Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Device Manager (Windows 2000), 25
Chapter 12 - Bluetooth and Jini
DeviceClass
class (javax.bluetooth), 53,57–58,261
Appendix
A - javax.bluetooth
Appendix
DeviceDiscovered()
B - javax.obex
method, 57
Appendix
C - Java Bluetooth
Development
on the PalmOS Platform
DeviceProperties.java
listing,
48–51
Appendix D - BlipNet 1.1 API
Devices (Bluetooth). SeeBluetooth devices
Index
Dial-up
networking, wireless, 5
List
of Figures
Dial-Up
Networking Profile, 26
List
of Tables
List
of Listings
DISCONNECT
operation (OBEX), 132
List of Sidebars
Disconnect() method of ClientSession object, 132
Discovery modes (Bluetooth), 52
Discovery Service (Jini), 244
DiscoveryAgent class, 52,56–57,63–64,261
DiscoveryListener interface, 57,64,261–262
Distance measuring, 34
Distributed computing, problems of, 242
Doc interface, 100
DocFlavor object, 100
DocPrintJob object, 101
Documents, in JSP, 99–101
Dynamic OS loader, 189
Index
E
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
E-mail stations inapplications
a hotel, 229using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
Echo service, 193–207
more.
Embedded Linux, 185
Embedded Windows, 185
Table of Contents
Employees, tracking in a building, 229
Bluetooth for Java
Emulator, vs. simulator, 138
Introduction
Chapter
Encrypt1 parameter
- Introducing
in connection
Bluetooth URL, 161–162, 174, 177
Chapter
2 method
- Bluetooth
1.1
Encrypt()
of RemoteDevice
class, 162
Chapter 3 - Before You Get Started
Encrypted data, decrypting, 176–178
Chapter 4
- Understanding the Java Bluetooth API
Encryption,
Chapter
5 - 159–163
Bluetooth with J2ME MIDP
Encryption
159
Chapter
6 - algorithm
Creating a(cipher),
Bluetooth
Print Server with JPS API
Chapter
7 - key,
Java159–161
and OBEX
Encryption
Chapter 8
- Using a Bluetooth Simulator
Enterprise Bluetooth applications, 225–240
Security
creating- Bluetooth
using Java,
226
Chapter
10
Wireless
Embedded
Systems with the Micro BlueTarget
qualifications of, 225
Chapter 9
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Ericsson,11–12
Chapter 12 - Bluetooth and Jini
EricssonABlipNet.
SeeBlipNet
Appendix
- javax.bluetooth
Appendix
Events (Jini),
B - javax.obex
245
Appendix
C - Java
Events (JPS),
99Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Example code in this book, working with, 81
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Index
F
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
FAILURE response
code (OBEX), 121,125
includes an API overview of the Java library, development of
Bluetooth-based
services, highlights of security concerns, and
FAX Profile, 26
more.
File transfer client, 131–134
File transfer example (JSR-82 OBEX API), 127–136
Table of Contents
File Transfer Profile, 27
Bluetooth for Java
File transfer server, 127–131
Introduction
Chapter
Fixed-wireless
1 - Introducing
commercial
Bluetooth
system, 182
Chapter
2 - Bluetooth
1.1 system, 181
Fixed-wireless
consumer
Chapter 3 - Before You Get Started
Fixed-wireless device, explained, 181
Chapter 4
- Understanding the Java Bluetooth API
Fixed-wireless
system,
creating,
207–223
Chapter
5 - Bluetooth
with
J2ME MIDP
Flash disk,
Chapter
6 - 188
Creating a Bluetooth Print Server with JPS API
Chapter
7 - Java187–189
and OBEX
Flash memory,
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Flat file system, RMS as, 79
Fossil Wrist PDA with Palm OS 4.1, 9
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
FTClient.java
listing, 132–134
Chapter
11 - Enterprise
Bluetooth Applications with the Ericsson BlipNet
Chapter
12 - Bluetooth
Jini
FTServer.java
listing, and
128–130
Appendix A - javax.bluetooth
Future Bluetooth devices, 8–9
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Index
G
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
Gaming (wireless)
includes an API overview of the Java library, development of
Bluetooth for, Bluetooth-based
7
services, highlights of security concerns, and
playing in restaurant
more. lobby, 9
Gate count (CPU), 183
GCFof(Generic
Connection Framework), 42,80,105
Table
Contents
Bluetooth
Java Profile, 24, 28, 51, 229
Generic for
Access
Introduction
Generic Object Exchange Profile, 27
Chapter 1
- Introducing Bluetooth
GET operation (OBEX), 121,123,131
Chapter 2 - Bluetooth 1.1
GetAppProperty()
MIDlet, 144
Chapter
3 - Before method
You Get of
Started
Chapter
4 - Understanding
the Java
Bluetooth
API
GetBluetoothAddress()
method,
51,
53
Chapter 5
- Bluetooth with J2ME MIDP
GetConnection()
method, BlipServer object, 234
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
GetDiscoverable() method, 53
GetDiscoveryAgent()
method,Simulator
56
Chapter
8 - Using a Bluetooth
Chapter
9 - Bluetooth
Security
GetEventFilter()
method,
234
Chapter
10 - Wireless method,
Embedded
GetFriendlyName()
53Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
GetLocalDevice() method, 51
Chapter 12 - Bluetooth and Jini
GetMajorDeviceClass()
method, 53
Appendix
A - javax.bluetooth
Appendix
GetMinorDeviceClass()
B - javax.obex method, 53
Appendix
C - Java
Bluetooth Development
on the PalmOS Platform
Grade school
environment,
232
Appendix D - BlipNet 1.1 API
Grocery store Bluetooth device tracker, 233–240
Index
Grocery
store environment, 226,233–240
List
of Figures
List of Tables
List of Listings
List of Sidebars
Index
H
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
Hands Free Profile,
28
includes an API overview of the Java library, development of
Bluetooth-based
services,
of security concerns, and
Hardcopy Cable Replacement Profile,
28,highlights
97
more.
HCI (Host Controller Interface), 20,187
HeaderSet interface (javax.obex), 117–118,122–123,265–266
Table of Contents
HeaderSet object, 131,135
Bluetooth for Java
Headset Profile, 26
Introduction
Chapter
HID (Human
1 - Introducing
Interface Device)
Bluetooth
protocol, 22
Chapter
2 -API
Bluetooth
1.1
High-level
(MIDP),
79
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Home, Bluetooth in, 8
Home office,
Bluetooth
in, J2ME
6
Chapter
5 - Bluetooth
with
MIDP
Host (Bluetooth),
41 a Bluetooth Print Server with JPS API
Chapter
6 - Creating
Chapter
7 - JavaInterface,
and OBEX41
Host Controller
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Hotel business center, Bluetooth-enabled, 156
Hotel e-mail stations, 229
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
HP iPAQ
series Pocket
PCApplications
antennae, with
4 the Ericsson BlipNet
Chapter
11 5400
- Enterprise
Bluetooth
Chapter
12 - Bluetooth
HTTP protocol
stack,and
17 Jini
Appendix A - javax.bluetooth
Human Interface Device Profile, 28
Appendix B - javax.obex
Human Interface Device (HID) protocol, 22
Appendix C - Java Bluetooth Development on the PalmOS Platform
Hybrid Bluetooth
Jini
253–255
Appendix
D - BlipNet
1.1federation,
API
Index
HYFLASH utility (HyNetOS), 189
List
of Figures
HYLOAD
utility (HyNetOS), 189
List of Tables
HYMON utility (HyNetOS), 189–190
List of Listings
HyNetOS
(for Micro BlueTarget), 185–191
List
of Sidebars
Bluetooth implementation, 186–187
operating environment components, 185
protocol manager, 187
structural overview, 186
tools,189–190
Hyperstone AG microprocessor, 183
Hyperstone RISC/DSP CPU architecture, 185
HYTRACE utility (HyNetOS), 190
Index
I
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
I/O, performing with
the GCF, 80
includes an API overview of the Java library, development of
Bluetooth-based
services, highlights of security concerns, and
Import statement, 95
more.
Impronto Developer Kit 1.0 for PalmOS, 269–272
Impronto Simulator (Rococo), 139–152
TableConsole,
of Contents
141–143
Bluetooth
forlist,
Java
device
151
Introduction
features of, 139
Chapter
1 - Introducing
Bluetooth
installation
of, 140–141
Chapter
running
2 - an
Bluetooth
application
1.1 in, 144
v.1.13 installation
screen,
140
Chapter
- Before You
Get Started
Chapter
4 vs.
- Understanding
Infrared,
Bluetooth, 1 the Java Bluetooth API
Chapter 5 - Bluetooth with J2ME MIDP
InitBlipServerConnection() constructor, 234
Chapter 6
- Creating a Bluetooth Print Server with JPS API
InputStream,
131,193
- Java and OBEX
Chapter 7
Intercomm
Chapter
8 - Profile,
Using a 27
Bluetooth Simulator
Chapter
9 - Bluetooth
Security
Interoperability,
any device
to any device, 6
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
IrDA (Infrared Data Association), 21,115
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
IsAuthenticated() method of RemoteDevice, 157
Chapter 12 - Bluetooth and Jini
IsEncrypted()
method of RemoteDevice class, 162
Appendix
A - javax.bluetooth
Appendix
B - javax.obex
IsTrustedDevice()
method of RemoteDevice class, 158
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Index
J
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
J2ME (Java 2 Micro
Edition) platform, 42,186
includes an API overview of the Java library, development of
MIDP,75–96 Bluetooth-based services, highlights of security concerns, and
overview of, 75
more.
J2ME Profiles, 75
vs. Bluetooth profiles, 29–30
Table of Contents
diagram of, 76
Bluetooth for Java
J2ME Wireless Toolkit, 78
Introduction
Chapter
1 - Introducing
Bluetooth
J2SE platform,
42
Chapter
with2BlipNet
- Bluetooth
API to1.1
access external resources, 228
Java3 Bluetooth
development
kits for, 105
Chapter
- Before You
Get Started
Chapter
4 -Application
Understanding
the Java file,
Bluetooth
JAD (Java
Descriptor)
144 API
Chapter 5
- Bluetooth with J2ME MIDP
Java
- Creating a Bluetooth Print Server with JPS API
for creating
enterprise Bluetooth applications, 226
Chapter
7
- Java
and OBEX
integrating
Bluetooth
with, 33–43
Chapter
- Using
a Bluetooth Simulator
and8OBEX,
115–136
Chapter
9 not
- Bluetooth
Security with, 33–34
when
to use Bluetooth
Chapter 6
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Java 2 Micro Edition (J2ME), 42,75–96,186
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Java Bluetooth APIs, 45–73
Chapter 12 - Bluetooth and Jini
Java Bluetooth
development kits for J2SE, 105
Appendix
A - javax.bluetooth
Appendix
B - javax.obex
Java Bluetooth
SDK vendors, 42–43
Appendix C - Java Bluetooth Development on the PalmOS Platform
Java implementation of Micro BlueTarget, 186–187
Appendix D - BlipNet 1.1 API
Java OBEX API, 115–136
Index
Java
Real-Time Technology, 34
List
of Figures
List
of Tables
Java
Specification Request, 35
List
of
Listings
Java.io package, 80
List of Sidebars
Java.util.stack,19
Javax.bluetooth package, 36–37,259–264
DataElement,59–60,65,260
DeviceClass,53,57–58,261
DiscoveryAgent,52,56–57,63–64,261
DiscoveryListener,57,64,261–262
L2CAPConnection,71–72,262
LocalDevice,51–53,56,262
RemoteDevice,53,57,157–158,162,263
ServiceRecord, 58–59,64,263
UUID,61–63,264
Javax.microedition.io package, 80,122
Javax.microedition.io.Connection class, 122
Javax.microedition.rms.RecordListener, 80
Javax.microedition.rms.RecordStore, 80
Javax.obex package, 36,116,121–122,265–268
classes in, 38
ClientSession class, 122
HeaderSet interface, 117,122–123
Operation class, 122–123
ResponseCodes class, 120,123–126
Bluetooth for Java
ServerRequestHandler
class, 126–127
byclass,
Bruce 127
Hopkins and Ranjith Antony
SessionNotifier
ISBN:1590590783
Apress © 2003 (352 pages)
Javax.print package, 99–101. See also JPS
The authors of this text describe how to develop wireless Java
Javax.print.attribute,
applications
99
using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Javax.print.attribute.standard,
99 services, highlights of security concerns, and
Bluetooth-based
more.
Javax.print.Doc interface,
100
Javax.print.DocFlavor,100
Table
of Contents package, 99
Javax.print.event
Bluetooth for Java
Javax.print.PrintService object, 100
Introduction
Javax.print.PrintServiceLookup
object, 101
- Introducing Bluetooth
Chapter 1
Javax.print.SimpleDoc
object, 100–101
Chapter
2 - Bluetooth 1.1
Chapter
3 -Community
Before You Get
Started34–38
JCP (Java
Process),
Chapter 4
- Understanding the Java Bluetooth API
Jini, 241–258
Chapter
5 - Bluetooth
Discovery
Service,with
244J2ME MIDP
Chapter
6 -245
Creating a Bluetooth Print Server with JPS API
events,
Chapter
- Java and
OBEX
how7it works,
245–253
Chapter
8 - Using
Bluetooth Simulator
integrating
witha Bluetooth,
251–255
Chapter
- Bluetooth
Join9protocol,
244 Security
Chapter
Leasing
10 - Service,
Wireless Embedded
244
Systems with the Micro BlueTarget
Lookup
243–247
Chapter
11 - Service,
Enterprise
Bluetooth Applications with the Ericsson BlipNet
Lookup
discovery,
Chapter
12 - Service
Bluetooth
and Jini 245–247
Service
lifecycle, 249–251
Appendix
A - Consumer
javax.bluetooth
Service
lifecycle, 245–249
Appendix
B - Provider
javax.obex
ServiceItem
245,
248–249,252–253
Appendix
C - Javaobject,
Bluetooth
Development
on the PalmOS Platform
ServiceRegistrar object, 247–248,249–250
ServiceTemplate object, 249
Index
solving distributed computing problems, 242
List of Figures
transactions, 245
Appendix D - BlipNet 1.1 API
List of Tables
Jini-Bluetooth-enabled
device, 256–257
List
of Listings
Jinioffederation,
List
Sidebars 243, 255
entities in, 245
functionality of members in, 243
joining,247–249
Jini network technology, 242–245
JMatos (PsiNaptic), 254
Join protocol (Jini), 244
JPS (Java Print Service), 97–113
architecture,99
attributes, 99
creating a Bluetooth Print Server with, 97–113
creating a document, 100–101
creating a print job and printing, 101–102
documents,99–101
event model, 99
identifying the data format, 100
integrating with Bluetooth, 104–112
listening for print status updates, 102
overview,98–99
relationship between printer and client, 98
searching for a print service, 101
JPS API packages, 99
Bluetooth for Java
JPS application example
by Bruce (JPSPrint),
Hopkins and102–104
Ranjith Antony
JPSBluetoothPrintClient.java
Apress © 2003 listing,
(352 pages)
109–112
ISBN:1590590783
The authors
this text describe how to develop wireless Java
JPSBluetoothPrint.java
listing,of105–109
applications using Bluetooth for a variety of platforms. This
JPSPrint application,
102–104
includes
an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
JPSPrint.java listing, 102–104
more.
JSR-82 API, 35,42,45–73
application simulation, 152
Tableas
ofonly
Contents
standardized Bluetooth API, 39–40
Bluetooth
for of,
Java
benefits
38–40
Introduction
compatible code, 96
Chapter
1 - Introducing
independent
of stackBluetooth
and radio, 38–39
Chapter
OBEX
2 APIs
- Bluetooth
in, 121–136
1.1
role3of,-35–36
Chapter
Before You Get Started
Chapter
4 - Understanding
theapplications,
Java Bluetooth
API
JSR-82-compliant
Bluetooth
139
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
JSR-82-compliant Bluetooth stack layers, 39
JSR-82 Expert
Group, companies in, 35–36
- Java and OBEX
Chapter 7
JSR-828 OBEX
API
transfer
example, 127–136
Chapter
- Using
a file
Bluetooth
Simulator
Chapter
9 - Bluetooth
Security
JSTARTUP.INI
file, 188–190
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
JVM (Java Virtual Machine), 186
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
JVM for Micro BlueTarget, 186–187
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Index
K
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
Keyboard (Bluetooth)
services, 60
includes an API overview of the Java library, development of
Bluetooth-based services, highlights of security concerns, and
more.
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Index
L
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
L2CAP (Logical Link
Control and Adaptation Protocol), 20
includes an API overview of the Java library, development of
client connections,
71
Bluetooth-based
services, highlights of security concerns, and
connection authentication
and authorization, 163
more.
connections, 70–72,163
vs. RFCOMM, 72
Tableserver
of Contents
connections, 70
Bluetooth for Java
L2CAP layers, 70
Introduction
L2CAPConnection
interface,
262
Chapter
1 - Introducing
Bluetooth
Chapter
L2CAPConnection
2 - Bluetooth
methods,
1.1
71–72
Chapter
3 - Before You
Get Started
L2CAPConnection
object,
71–72
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
L2CAPConnectionNotifier interface, 262
L2CAPEcho
Serviceaexample,
Chapter
6 - Creating
Bluetooth192–207
Print Server with JPS API
L2CAPEchoClient.java
listing, 196–207
Chapter
7 - Java and OBEX
Chapter
8 - Using a Bluetooth
Simulator
L2CAPEchoServer.java
listing,
193–196
Chapter 9
- Bluetooth Security
LAN Access Profile, 26,232
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Laptop to phone connection sharing, 5
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Layers 12
(Bluetooth
protocol),
Chapter
- Bluetooth
and JiniUUID values for, 61
Appendix
A the
- javax.bluetooth
Layers of
protocol stack, 18–20,23,61
Appendix B - javax.obex
Leasing service (Jini), 244
Appendix C - Java Bluetooth Development on the PalmOS Platform
Light waves, 34
Appendix D - BlipNet 1.1 API
Line-of-site issues of infrared, 1
Index
List
of Figures
Listings
List of
1024-bit
Tables encryption key, 160–161
bank
account information, 160
List of
Listings
bank
account information encrypted, 161
List of
Sidebars
BeamTsk.java,87–88
BluetoothSetup1.java,47–48
ChatClient.java,146–150
ChatServer.java,145–146
ClientApp.java, 165–170
DeviceProperties.java,48–51
FTClient.java, 132–134
FTServer.java, 128–130
JPSBluetoothPrintClient.java, 109–112
JPSBluetoothPrint.java,105–109
JPSPrint.java,102–104
L2CAPEchoClient.java,196–207
L2CAPEchoServer.java,193–196
mydevice.xml,143
opening connections on Bluetooth Server, 68–69
PiconetMIDlet.java,91–95
ServerApp.java, 163–165
service registration process, 66–67
SPP2COMM.java,208–223
stack initiation code for Atinav SDK, 47
Stealth.java, 84–87
Tracking.java, 235–240
Bluetooth for Java
LocalDevice class,
51–53,56,262
by Bruce Hopkins and Ranjith Antony
Lookup Service discovery
(Jini),
245–247
Apress © 2003
(352
pages)
ISBN:1590590783
authors
this text249
describe how to develop wireless Java
Lookup Services The
(LUS),
Jini, of
243–247,
applications using Bluetooth for a variety of platforms. This
LookupPrintServices()
method,
includes
an API 101
overview of the Java library, development of
Bluetooth-based
services, highlights of security concerns, and
Low-level API (MIDP), 79
more.
Low-power wireless technology,Bluetooth as, 2
LUS (Lookup Services), Jini, 245–247,249
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Index
M
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
MAME (Multiple Arcade
Machine Emulator) project, 138
includes an API overview of the Java library, development of
Bluetooth-based
services,
Manufacturing facility, Bluetooth in,
182 highlights of security concerns, and
more.
Master and slave concept, 1,30–31
Micro BlueTarget (Smart Network Devices), 179–224
Tableapplication
of Contents
development on, 187–224
Bluetooth
for Java
Bluetooth
implementation of, 187
Introduction
communication between devices, 192–207
Chapter
1 - Introducing
Bluetooth
creating
a fixed-wireless
system, 207–223
Chapter
for external
2 - Bluetooth
serial communication,
1.1
184
hardware
components
diagram, 183
Chapter
3 - Before
You Get block
Started
hardware
configuration,the
182–184
Chapter
4 - Understanding
Java Bluetooth API
hardware
details, 184
Chapter
5 - Bluetooth
with J2ME MIDP
HyNetOS,
185–191
Chapter
6 - Creating
a Bluetooth Print Server with JPS API
Java7 implementation,
Chapter
- Java and OBEX186–187
JVM for,
186–187
- Using a Bluetooth Simulator
libraries,186–187
Chapter 9 - Bluetooth Security
memory map of, 188
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
operating environment components, 185
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
operating system for, 185–191
Chapter 12 - Bluetooth and Jini
operating system tools, 189–190
Appendix
A - javax.bluetooth
programming,
190–224
Appendix
B
- javax.obex
software
configuration, 185–187
Appendix
C - Java
Bluetooth
standard
version,
180 Development on the PalmOS Platform
Appendix
D
BlipNet
1.1
Starter Kit, 180,184API
Indexwhat it is, 179–182
List of
Wireless
Figures Network Access Point, 191–192
Chapter 8
List
of Tables
MIDlet
suite, 78
List of Listings
MIDlets
defined, 78
developing,78–80
JAD (Java Application Descriptor) file, 144
skeletal structure of, 78–79
List of Sidebars
MIDP (Mobile Information Device Profile), 75–96
high-level API and low-level API, 79
packages for mobile devices, 77
user interface components, 79
MIDP 1.0 device, qualifications for, 77
MIDP 2.0 specification, 77
MIDP 2.0 wireless application functionality, 77–78
MIDP-Chat application, 272
Mobile phone
configuring in Impronto Simulator,143
and laptop connection sharing, 5
limitations of, 3
and PDA data transfer, 3–4
Mobiwave BPA-D10 Bluetooth Protocol Analyzer, 163,173–178
data captured by, 174–175
data transmission sniffing, 173
Motorola,35
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
MTUs (MaximumApress
Transmission
Units),
© 2003 (352
pages) 70–71
The authors
of this
text describe how to develop wireless Java
Multicast announcements
(LUS),
247
applications using Bluetooth for a variety of platforms. This
Multicast requests
(LUS),an
247,
250
includes
API
overview of the Java library, development of
Bluetooth-based
highlights of security concerns, and
Multipoint device communication,services,
16
more.
Museum environment, 226
Mydevice.xml listing, 143
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Index
N
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
NAME headers (OBEX),
122
includes an API overview of the Java library, development of
Bluetooth-based
services,
highlights of security concerns, and
Node administration (BlipManager),
231–232
more.
Nokia N-Gage gaming system, Bluetooth-enabled, 7
Nondiscoverable mode (stealth mode), 81–83
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Index
O
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
OBEX (Object Exchange),
21,115–136
includes an API overview of the Java library, development of
called IrOBEXBluetooth-based
in IrDA protocolservices,
stack, 116
highlights of security concerns, and
what it is, 115–121
more.
OBEX API file transfer example, 127–136
OBEX
in JSR-82, 121–127
Table
of APIs
Contents
Bluetooth
for Java
OBEX clients
and servers, message flow between, 120
Introduction
OBEX definition, explained, 117
Chapter 1
- Introducing Bluetooth
OBEX headers, 117
Chapter 2 - Bluetooth 1.1
creating,119
Chapter 3 - Before You Get Started
in java.obex.HeaderSet interface, 118
Chapter 4
- Understanding the Java Bluetooth API
OBEX libraries,
116 with J2ME MIDP
Chapter
5 - Bluetooth
Chapter
OBEX Object
6 - Creating
Model,a117–119
Bluetooth Print Server with JPS API
Chapter
7 - Java and
OBEX
OBEX operations,
119,
134–136
Chapter 8
- Using a Bluetooth Simulator
OBEX protocol client/server architecture, 117
Chapter 9
- Bluetooth Security
OBEX protocol
to implement
116–117
Chapter
10 - Wireless
EmbeddedBluetooth
Systems profiles,
with the Micro
BlueTarget
OBEX server
responseBluetooth
codes, 123–126
Chapter
11 - Enterprise
Applications with the Ericsson BlipNet
Chapter
12 - Bluetooth
and 120,
Jini 123–126
OBEX server
responses,
Appendix A - javax.bluetooth
OBEX Session Protocol, 117,119–121
Appendix B - javax.obex
Object Model (OBEX), 117–119
Appendix C - Java Bluetooth Development on the PalmOS Platform
Object Push
Profile,
27,API
229–230,232–233
Appendix
D - BlipNet
1.1
Index
Offices, Bluetooth in, 6,226
List of Figures
Omnidirectional transmissions, 1
List of Tables
OnConnect() method, 128
List of Listings
OnGet()
method, 128
List
of Sidebars
Opening connections on Bluetooth Server (listing), 68–69
Operation interface (javax.obex), 123,266
Operation object (javax.obex), 122,126
Operations (OBEX), 119,134–136
OutputStream,193
Index
P
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
Packet data, handling
with L2CAP, 72
includes an API overview of the Java library, development of
Bluetooth-based
highlights 269
of security concerns, and
Palm DK (Impronto Developer Kitservices,
1.0 for PalmOS),
more.
included software, 271
installation,272
sample application, 272
Table of Contents
supported Bluetooth protocols, 269
Bluetooth for Java
system requirements, 270
Introduction
Palm SD
cardBluetooth
for PalmOS 4 devices, 15
Chapter
1 Bluetooth
- Introducing
Chapter
PalmOS
2 4-devices,
BluetoothPalm
1.1 SD Bluetooth card for, 15
Chapter
3 4.1,
- Before
GetPDA
Started
PalmOS
FossilYou
Wrist
with, 9
Chapter 4 - Understanding the Java Bluetooth API
PalmOS emulator, 140,271
Chapter 5
- Bluetooth with J2ME MIDP
PalmOS
Chapter
6 platform
- Creating a Bluetooth Print Server with JPS API
Bluetooth
development on, 269–272
- Java and OBEX
running versions of, 138
Chapter 7
Chapter 8
- Using a Bluetooth Simulator
PalmSource
emulator,
138
Chapter
9 - Bluetooth
Security
Chapter
10 - Wireless
Systems
with
PAN (Personal
AreaEmbedded
Networking)
Profile,
26 the Micro BlueTarget
Chapter
11 - Enterprise Bluetooth
Applications with
PasswordAuthentication
class (javax.obex),
266 the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
PC to peripherals, replacing cable between, 5
Appendix A - javax.bluetooth
PCs, connecting
two, 5
Appendix
B - javax.obex
Appendix
PDA to phone
C - Java
data
Bluetooth
transfer,
Development
3–4
on the PalmOS Platform
Appendix
PDAs D - BlipNet 1.1 API
IndexBluetooth-enabled,4
List of
Figures
service
discovery process for, 60
List of Tables
Peripherals connected wirelessly, 5–6
List of Listings
Persistent storage, RMS for, 79–80
List of Sidebars
Personal area networks, 30–31
Personal networks, PC to PC, 5
PIC family microcontrollers, 184
Piconet Browser example application, 88–96
displaying Bluetooth devices in the area, 90
displaying remote device services, 91
initial screen for, 89
PiconetMIDlet.java listing, 91–95
Piconets (Bluetooth), 30–31
PIN (personal identification number) codes, 156
PLC (Programmable Logic Controller), 207
Point-to-point device communication, 15
POSE (PalmOS emulator), 140
Power classes of Bluetooth devices, 16–17
Power user, 6
PPP protocol, 192
PREKNOWN device, explained, 56–57
Print attributes (JPS), 99
Bluetooth for Java
Print job, creatingbyinBruce
JPS, 101–102
ISBN:1590590783
Hopkins and Ranjith Antony
Print server
Apress © 2003 (352 pages)
client submitting
file to, 109
Theaauthors
of this text describe how to develop wireless Java
creating with JPS
applications
API, 97–113
using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Print services
Bluetooth-based services, highlights of security concerns, and
explained,100more.
searching for in JPS, 101
Print status updates, in JPS, 102
Table of Contents
Print() method,
Bluetooth
for Java101
Introduction
Printer adapter (Bluetooth), 97
Chapter
- Introducing
Printers1 (Bluetooth),
20,Bluetooth
100
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Printing4
Chapter
- Understanding the Java Bluetooth API
PrintFile() method, 105
in JPS,
Chapter
5 -101–102
Bluetooth with J2ME MIDP
wireless,
5–6
- Creating a Bluetooth Print Server with JPS API
PrintJobListener
interface,
Chapter
7 - Java and
OBEX 102
Chapter 6
Chapter
8 - Using
a Bluetooth
PrintService
object,
100–101 Simulator
Chapter 9
- Bluetooth Security
PrintServiceLookup
class, 101
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
PrintStatus class, 102
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Profile 12
interdependencies,
28–30
Chapter
- Bluetooth and Jini
Appendix
- javax.bluetooth
Profiles A
(Bluetooth),
23–28
Appendix
vs. J2ME
B - javax.obex
profiles, 29–30
OBEX
implement,
116
Appendix
C to
- Java
Bluetooth
Development on the PalmOS Platform
TCP/IP-based,
Appendix
D - BlipNet252
1.1 API
IndexUUID values for, 62
List
of Figures
Profiles
(J2ME), 75
List
of
Tables
Profiles (JSR-82-compliant required), 39
List of Listings
PROJECT.HEX file, 187
List of Sidebars
Protocol Analyzer (Mobiwave BPA-D10),163,173–178
data captured by, 174–175
data transmission sniffing, 173
Protocol layers (Bluetooth), UUID values for, 61
Protocol multiplexing, 20
Protocol stack (Bluetooth), 17–23
Protocol stack (Bluetooth) layers, 18–20,23
ProtocolDescriptorList, 130
Protocols (Bluetooth), Palm DK supported, 269
Proximity measurement, 34
PsiNode development platform, 254–255
PUT operation (OBEX), 121,123,135–136
Index
R
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
Radio frequencies,
13
includes an API overview of the Java library, development of
Bluetooth-based
services, highlights of security concerns, and
Radio signals, 12,34
more.
Radio spectrum, 12–17
Radios (Bluetooth), 13. See also Bluetooth devices
Table of Contents
RecordListener object, 80
Bluetooth for Java
RecordStore object, 80
Introduction
Chapter
RemoteDevice
1 - Introducing
class (javax.bluetooth),
Bluetooth
53,57,263
authorize()
method,
Chapter
2 - Bluetooth
1.1158
encrypt()
method,
Chapter
3 - Before
You162
Get Started
isAuthenticated()
method,
Chapter
4 - Understanding
the 157
Java Bluetooth API
isEncrypted()
method,
Chapter
5 - Bluetooth
with 162
J2ME MIDP
isTrustedDevice()
Chapter
6 - Creating a method,
Bluetooth158
Print Server with JPS API
Request
Chapter
7 packet
- Java (OBEX),
and OBEX121
Chapter
8 -codes
Using (OBEX
a Bluetooth
Simulator
Response
server),
123–126
Chapter 9
- Bluetooth Security
Response packet (OBEX), 121
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
ResponseCodes class (javax.obex), 123–126,267
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Restaurant
arcade,
9
Chapter
12 - lobby
Bluetooth
and Jini
Appendix
A - javax.bluetooth
Retail store,
Bluetooth device tracker for, 233–240
Appendix B - javax.obex
RetrieveDevices() method, 56–57
Appendix C - Java Bluetooth Development on the PalmOS Platform
RFCOMM (wireless serial port), 21
connections, 67–70
Index
vs. L2CAP, 72
Appendix D - BlipNet 1.1 API
List of Figures
RFCOMM
List
of Tableslayer, 25
RI of
(Reference
List
Listings Implementation), 36
List
of Sidebars
RISC/DSP
32-bit CPU (Hyperstone), 183,185
RMS (Record Management System), 79
logical representation of, 80
for persistent storage, 79–80
Rococo Impronto Simulator, 139–152
Index
S
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
Scatternets (Bluetooth),
31
includes an API overview of the Java library, development of
Bluetooth-based
services,
highlights of security concerns, and
SDDB (Service Discovery Database),
58–60
more.
connection URLs and, 130
registering and storing services in, 66
service records in, 59
Table of Contents
service registration in, 127
Bluetooth for Java
SDP (Service Discovery Protocol), 20
Introduction
Chapter
1 - 24,
Introducing
Bluetooth
SDP layer,
58
Chapter
2 - Bluetooth
1.1 63–64
SearchServices()
method,
Chapter 3 - Before You Get Started
Security,155–178
- Understanding the Java Bluetooth API
authentication, 156–158
Chapter 5 - Bluetooth with J2ME MIDP
encryption,159–163
Chapter 6 - Creating a Bluetooth Print Server with JPS API
server authorization, 158–159
Chapter 4
Chapter 7
- Java and OBEX
Security administration (BlipManager), 231
Chapter 8
- Using a Bluetooth Simulator
Security
attempting
to connect to server, 171
Chapter
9 client
- Bluetooth
Security
Chapter
10example,
- Wireless
Embedded Systems with the Micro BlueTarget
Security
163–178
Chapter
11measures,
- Enterprise
Bluetooth Applications with the Ericsson BlipNet
Security
155–163
Chapter 12 - Bluetooth and Jini
Security server
prompting user for PIN, 172
Appendix B - javax.obex
waiting for client to connect, 170
Appendix A - javax.bluetooth
Appendix C - Java Bluetooth Development on the PalmOS Platform
SelectService() method, 63–64
Appendix D - BlipNet 1.1 API
Serial Port Profile, 25,67,145,208,224
Index
client
connections with, 69–70
List of
Figures
server
connections with, 68–69
List of
Tables
List
Server
of Listings
authentication, 156–157
List
of Sidebars
Server
authorization, 158–159
Server connections with Serial Port Profile, 68–69
Server encryption, 161–162
ServerApp.java listing, 163–165
ServerRequestHandler class, 126–128,268
ServerRequestHandler methods, 126
Service Consumer lifecycle (Jini), 249–253
Service Consumers (Jini), 245,249–253
Service discovery, 58–65,88,91
Service Discovery Application Profile, 24,58
Service discovery process for a PDA, 60
Service Providers (Jini), 245
lifecycle,247–249
and Service Consumer, 253
Service record attributes, 59–60
Service records in the SDDB, 59
Service registration, 65–67
defined, 65
Bluetooth for Java
process listing,
66–67
in the SDDB, by
127Bruce Hopkins and Ranjith Antony
ISBN:1590590783
Apress © 2003 (352 pages)
ServiceClassIDList,130
The authors of this text describe how to develop wireless Java
ServiceDatabaseState,
applications
131 using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
ServiceItem leasing,
247–249 services, highlights of security concerns, and
Bluetooth-based
more.
ServiceItem object
(Jini), 245,247–249,250–252
ServiceName object, 69,131
Table
of Contentsclass, 58–59, 64, 263
ServiceRecord
Bluetooth for Java
ServiceRecordHandle,130
Introduction
ServiceRecordState,
130
- Introducing Bluetooth
Chapter 1
ServiceRegistrar
object
Chapter
2 - Bluetooth
1.1(Jini), 247–248, 250–251
Chapter
3 - Before You Get Started
ServiceRegistrationException
class, 263
Chapter 4 - Understanding the Java Bluetooth API
Services, registering and storing in the SDDB, 66
Chapter 5
- Bluetooth with J2ME MIDP
ServicesDiscovered() method, 64
Chapter 6
- Creating a Bluetooth Print Server with JPS API
ServiceTemplate
object
(Jini), 250
Chapter
7 - Java and
OBEX
Chapter
- Using a Bluetooth
Session8 management,
226 Simulator
Chapter
- Bluetooth
Security
Session9 Protocol
(OBEX),
117,119–121
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
SessionNotifier interface (javax.obex), 127,268
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Sessions,
68and Jini
Chapter
12 -defined,
Bluetooth
Appendix
SetDiscoverable()
A - javax.bluetooth
method, 52
Appendix
B - javax.obex
SetEnvVars
script, 140–141
Appendix C - Java Bluetooth Development on the PalmOS Platform
SETPATH operation (OBEX), 121,135
Appendix D - BlipNet 1.1 API
SetPath() method, 135
Index
Shared
link key, 156
List
of Figures
List
of Tables
Shopping
malls, 226
List of Listings
Signal strength indicator, 33
List of Sidebars
SimpleDoc object, 100–101
Simulator (Bluetooth), 137–153
vs. emulator, 138
pros and cons of using, 138–139
Simulator.bin,140
Simulator.exe, 140
Slave list dialog box, 176
Slaves and master concept, 1,30–31
Small office, Bluetooth in, 6
Smart Network Devices, 183,185
SmartDecrypt (Mobiwave Protocol Analyzer), 176–178
SND operating system (HyNetOS), 185
SoC (System-on-Chip) architecture, 183,185
Sound applications, Bluetooth for, 6–7
SPP.SeeSerial Port Profile
SPP2COMM.java listing, 208–223
Stack (Bluetooth), 41
Stack initialization, 47–51,95
Bluetooth for Java
Stack initializationbycode
for Atinav SDK, 47
Bruce Hopkins and Ranjith Antony
Stack layers (JSR-82-compliant
39
Apress © 2003 (352Bluetooth),
pages)
ISBN:1590590783
The authors
of this textobject,
describe
how to develop wireless Java
StartInquiry() method,
DiscoveryAgent
56–57
applications using Bluetooth for a variety of platforms. This
Stealth mode (nondiscoverable
includes an API mode),
overview81–88
of the Java library, development of
Bluetooth-based
Stealth Mode example,
81–88 services, highlights of security concerns, and
more.
Stealth.java listing, 84–87
StreamConnectionNotifier object, 66
Table of Contents
SUCCESS
code (OBEX), 121,125
Bluetooth
for response
Java
Introduction
Sun Microsystems Java 2 Micro Edition. SeeJ2ME platform
Chapter
1 - Introducing
Sun Microsystems
Jini. Bluetooth
SeeJini
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Symmetrical encryption, 159,161
Synchronization
Profile, 27the Java Bluetooth API
Chapter
4 - Understanding
System5monitor
console
BlueTarget), 189
Chapter
- Bluetooth
with(Micro
J2ME MIDP
Chapter
- Creating
Bluetooth
Print Server
with JPS API
System6trace
windowa (Micro
BlueTarget),
190
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Index
T
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
using Bluetooth for a variety of platforms. This
TCK (Technologyapplications
Compatibility
Kit), 36
includes an API overview of the Java library, development of
Bluetooth-based
highlights of security concerns, and
TCP/IP-based Bluetooth profiles,services,
252
more.
TCS (Telephony Control Protocol Specification), 21
TCS-BIN,21
Table of Contents
TCS Binary, 21
Bluetooth for Java
TDK Bluetooth Developer's Kit, 271
Introduction
Chapter
TDK USB
1 -Bluetooth
Introducing
device,
Bluetooth
83–84
Chapter
2 using
- Bluetooth
1.1 simulator for, 137–153
Testing,
Bluetooth
Chapter 3 - Before You Get Started
Text messages example, 145–152
Chapter 4
- Understanding the Java Bluetooth API
Thread5scheduler,
187
Chapter
- Bluetooth
with J2ME MIDP
TINI (Tiny
Interface),
254–255
Chapter
6 -Internet
Creating
a Bluetooth
Print Server with JPS API
Chapter
7 - Java
TINI chipset,
254and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
TINI devices, 255
TINI microcontroller, 255
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Tracking
a building,
229
Chapter
11employees
- EnterpriseinBluetooth
Applications
with the Ericsson BlipNet
Chapter
12 - Bluetooth and
Jini 235
TrackingEventListener
class,
Appendix A - javax.bluetooth
Tracking.java, 234–240
Appendix B - javax.obex
Tracking.java listing, 235–240
Appendix C - Java Bluetooth Development on the PalmOS Platform
Transactions
(Jini),1.1
245API
Appendix
D - BlipNet
Index
Triangulation, 34
List
of Figures
Trusted
devices, 158
List of Tables
TYPE headers (OBEX), 122
List of Listings
List of Sidebars
Index
U
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
UART device, 183
includes an API overview of the Java library, development of
Bluetooth-based
Unicast request (LUS),
247,250 services, highlights of security concerns, and
more.
UUID (Universal Unique Identifier), 61
UUID class (javax.bluetooth), 61–63,264
Table of Contents
UUID() methods, 62–63
Bluetooth for Java
UUID values
Introduction
for Bluetooth
profiles,
62
Chapter
1 - Introducing
Bluetooth
for Bluetooth
protocol layers, 61
- Bluetooth 1.1
Chapter 2
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Index
V
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
Vending machine,
Bluetooth-enabled, 181
includes an API overview of the Java library, development of
Bluetooth-based
of security concerns, and
Virtual serial port communicationservices,
protocol.highlights
SeeRFCOMM
more.
Voice applications, 6–7,33–34
Table of Contents
Bluetooth for Java
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Index
W
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
Apress © 2003 (352 pages)
ISBN:1590590783
The authors of this text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
WAP (Wireless Access
Protocol), 21,229
includes an API overview of the Java library, development of
Bluetooth-based
services, highlights of security concerns, and
WAP over Bluetooth, 229
more.
Windows 2000 Device Manager, 25
Windows CE.NET, 185
Table of Contents
Wireless communication protocol, Bluetooth as, 1
Bluetooth for Java
Wireless dial-up networking, 5
Introduction
Chapter
Wireless
1 embedded
- Introducing
systems,
Bluetooth
179–224
Chapter
2 LAN
- Bluetooth
1.1
Wireless
(802.1b)
vs. Bluetooth, 1–3
Chapter 3 - Before You Get Started
Wireless Network Access Point, 191–192
Chapter 4
- Understanding the Java Bluetooth API
Wireless
port. See
Chapter
5 serial
- Bluetooth
withRFCOMM
J2ME MIDP
Wireless
Monitor
example,
Chapter
6 System
- Creating
a Bluetooth
Print207–223
Server with JPS API
client
223–224
Chapter
7 options,
- Java and
OBEX
server
Chapter
8 setup,
- Using208–223
a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
List of Figures
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
Apress © 2003 (352 pages)
Chapter 1: The
Introducing
Bluetooth
authors of this text
describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes
API overview
the Java
library,
of
Figure 1-1: The
shortan
antennae
on HPofiPAQ
5400
seriesdevelopment
Pocket PC allows
it to communicate via
Bluetooth-based services, highlights of security concerns, and
Bluetooth and
802.11b.
For
added
security,
this
model
also
includes
a
fingerprint
reader.
more.
Figure 1-2: The Bluetooth-enabled Nokia N-Gage wireless gaming system
Table of Contents
Figure 1-3: Although the Fossil Wrist PDA doesn't contain any Bluetooth hardware, it does come
preloaded with a Bluetooth-enabled OS— the Palm OS 4.1. Palm OS is a registered trademark of
Introduction
Palm, Inc.
Bluetooth for Java
Chapter 1
- Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter
2: Bluetooth 1.1
- Before You Get Started
Chapter 3
Chapter 4
- Understanding the Java Bluetooth API
Figure- 2-1:
The 3COM USB Bluetooth module
Bluetooth with J2ME MIDP
Chapter 5
Chapter
6 - 2-2:
Creating
a Bluetooth
Print1.Server
with JPS API
Figure
The CSR
BlueCore
This single-chip
solution includes a microprocessor, RAM, I/O
Chapter
7
Java
and
OBEX
controller, and Bluetooth implementation in a single package! This is most likely the smallest radio
Chapter
- Using
a Bluetooth
that8 you've
ever
seen. Simulator
Chapter 9
- Bluetooth Security
Figure
The Palm
SD Bluetooth
cardthe
forMicro
PalmBlueTarget
OS 4 devices. Palm OS is a registered trademark of
Chapter
10 - 2-3:
Wireless
Embedded
Systems with
Palm,
Chapter
11 -Inc.
Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Figure 2-4: You can only connect to one Bluetooth device at a time if you have hardware that only
supports point-to-point communication.
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix
Figure
C - 2-5:
JavaYou
Bluetooth
can connect
Development
to up to
onseven
the PalmOS
Bluetooth
Platform
devices at a time if you have multipoint-capable
hardware.
Appendix
D - BlipNet 1.1 API
Index
Figure 2-6: A) The computer may be attached to its peripherals, but it can't control them without a
driver. B) The computer may be attached to a Bluetooth device, but it can't control it without a stack.
List of Figures
List of Tables
List ofFigure
Listings
2-7: The Bluetooth protocol stack
List of Sidebars
Figure 2-8: As you can see in Windows 2000, the operating system thinks that COMM10 and
COMM11 are actual serial ports!
Figure 2-9: Bluetooth profile interdependencies
Figure 2-10: In a piconet, the slaves can only communicate to the master.
Figure 2.11: A scatternet is formed when a slave in one piconet is the master in another piconet.
Chapter 4: Understanding the Java Bluetooth API
Figure 4-1: Service records in the SDDB
Figure 4-2: An individual attribute of a service record
Figure 4-3: An illustration of a service record attribute
Figure 4-4: DataElements
Figure 4-5: The service discovery process for a PDA that wants to use the services of a Bluetooth
keyboard
Chapter 5: Bluetooth
Bluetooth
with J2ME MIDP
for Java
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
Figure 5-1: J2ME
Profiles
andpages)
configurations
Apress
© 2003 (352
The authors of this text describe how to develop wireless Java
Figure 5-2: Aapplications
logical representation
of an RMS record store
using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Figure 5-3: The
application starts,
andhighlights
is now looking
for remote
Bluetooth
devices.
Bluetooth-based
services,
of security
concerns,
and
more.
Figure 5-4: After a remote device is found, we now go into stealth mode (i.e., nondiscoverable).
5-5: The TDK USB Bluetooth device using a CSR Bluetooth radio
Table Figure
of Contents
Bluetooth for Java
Figure 5-6: The initial screen for the Piconet Browser application
Introduction
Chapter
1 - 5-7:
Introducing
Bluetooth
Figure
The Piconet
Browser displays a list of Bluetooth devices in the area.
Chapter 2 - Bluetooth 1.1
Figure
TheYou
Piconet
Browser now displays the services offered by the remote device.
Chapter
3 - 5-8:
Before
Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter
- Bluetooth
6: Creating
with J2ME a
MIDP
Bluetooth Print Server with JPS API
Chapter 5
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter
Figure
7 - 6-1:
JavaYou
and can
OBEX
use the 3Com Wireless Bluetooth Printer Adapter in order to make a traditional
(i.e.,
printer
Bluetooth enabled.
Chapter
8 non-Bluetooth)
- Using a Bluetooth
Simulator
Chapter 9
- Bluetooth Security
Figure 6-2: Using the handy utility provided in this chapter, you can turn your desktop into a Bluetooth
print server.
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Chapter 7: Java and OBEX
Appendix A - javax.bluetooth
Appendix B - javax.obex
Figure
is called
IrOBEX on
in the
protocol
stack.
Appendix
C - 7-1:
JavaOBEX
Bluetooth
Development
the IrDA
PalmOS
Platform
Appendix D - BlipNet 1.1 API
Figure 7-2: An OBEX header
Index
List ofFigure
Figures7-3: A sample message flow between OBEX clients and servers
List of Tables
Chapter 8: Using a Bluetooth Simulator
List of Listings
List of Sidebars
Figure 8-1: The Rococo Impronto Simulator version 1.1 installation screen
Figure 8-2: The Rococo Impronto Simulator Console
Figure 8-3: Creating a new Bluetooth device in the Simulator Console is pretty simple.
Figure 8-4: Configuring a cell phone in the Simulator environment
Figure 8-5: The ChatServer Bluetooth device in the Impronto Simulator device list
Figure 8-6: The ChatServer interacting with the ChatClient in the Impronto Simulator environment
Figure 8-7: The server has sent a message and the client responds.
Figure 8-8: The client receives a message and sends a reply.
Chapter 9: Bluetooth Security
Figure 9-1: The Mobiwave BPA-D10 Bluetooth Protocol Analyzer
Figure 9-2: The security server is waiting for the client to connect.
Figure 9-3: The security client is attempting to connect to the server.
Bluetooth for Java
by Bruce
Hopkins
Ranjiththe
Antony
Figure 9-4: The
security
serverand
prompts
user to enter aISBN:1590590783
PIN for the application.
Apress © 2003 (352 pages)
Figure 9-5: The
has succeeded.
Theauthentication
authors of this process
text describe
how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
Figure 9-6: You
needan
to API
be very
careful
if you're
sendingdevelopment
sensitive data
includes
overview
of the
Java library,
of unencrypted between
Bluetooth devices
Bluetooth-based
because it services,
can be captured
highlightsbyofasecurity
third party
concerns,
using aand
Bluetooth Protocol Analyzer.
more.
Figure 9-7: With encryption enabled, the Protocol Analyzer is still able to capture the data
transmission; however, the data is corrupted.
Table of Contents
Bluetooth for Java
Chapter 10: Wireless Embedded Systems with the Micro BlueTarget
Introduction
Chapter 1
- Introducing Bluetooth
Chapter 4
- Understanding the Java Bluetooth API
Figure 10-1: The Micro BlueTarget standard version is a small form factor embedded system with a
Chapter 2 - Bluetooth 1.1
board outline of just 3.25.9 cm! This is a great solution for OEMs that want to make their devices
Chapter 3 - Before You Get Started
Bluetooth enabled.
Chapter
5 - 10-2:
Bluetooth
MIDP Starter Kit uses a standard Micro BlueTarget and adds RS-232
Figure
The with
MicroJ2ME
BlueTarget
Chapter
- Creating
a Bluetooth
with JPS API
and6 Ethernet
ports,
which isPrint
idealServer
for developers
who need to create quick prototypes and proofs of
Chapter
concepts.
7 - Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Figure- 10-3:
A Bluetooth phone utilizing the services of a fixed-wireless consumer system— a
Bluetooth Security
Bluetooth-enabled vending machine
Chapter 9
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter
11 - 10-4:
Enterprise
Bluetooth
Applications
the Ericsson
Figure
A Bluetooth
PDA
receiving with
the status
from aBlipNet
fixed-wireless commercial system— a
Chapter
12
Bluetooth
and
Jini
Bluetooth-enabled machine in a manufacturing facility
Appendix A - javax.bluetooth
Figure
A block diagram of the Micro BlueTarget hardware components
Appendix
B - 10-5:
javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Figure 10-6: A structural overview of the HyNetOS for the Micro BlueTarget
Appendix D - BlipNet 1.1 API
IndexFigure 10-7: The memory map of the Micro BlueTarget. End user applications have about 1.5MB of
List ofspace
Figures
on the flash disk.
List of Tables
10-8: Using the built-in functionality of the Micro BlueTarget, you can have any Bluetooth device
List ofFigure
Listings
with the LAN Access Profile access the Internet (or any other Ethernet-based network).
List of Sidebars
Figure 10-9: The L2CAPEcho Service
Figure 10-10: Using the Micro BlueTarget to create a fixed-wireless system
Chapter 11: Enterprise Bluetooth Applications with the Ericsson
BlipNet
Figure 11-1: An architecture diagram of the Ericsson BlipNet
Figure 11-2: You can use the BlipNet API and custom J2SE code to access external resources like
databases, directories, and e-mail servers.
Figure 11-3: A single BlipNode
Figure 11-4: The BlipManager application
Chapter 12: Bluetooth and Jini
Figure 12-1: These three entities must exist before a Jini federation is established. The federation itself
hasn't been formed because the entities don't know anything about each other yet.
Figure 12-2: The Service Provider discovers the Lookup Service and receives its
Bluetooth for Java
ServiceRegistrar object. The ServiceRegistrar is used to interact with the Lookup Service
ISBN:1590590783
by Bruce Hopkins and Ranjith Antony
via its public methods.
Apress © 2003 (352 pages)
this textregisters
describe its
how
to develop wireless
Java
Figure 12-3: The
The authors
ServiceofProvider
ServiceItem
with the
Lookup Service.
applications using Bluetooth for a variety of platforms. This
an API
overview
of theaJava
library,request
development
of Service Consumer and
Figure 12-4: includes
The Lookup
Service
receives
multicast
from the
Bluetooth-based services, highlights of security concerns, and
responds withmore.
a unicast message containing the ServiceRegistrar object.
Figure 12-5: The Service Consumer uses the local ServiceRegistrar object to look up services that are
in the Lookup Service.
Table registered
of Contents
Bluetooth for Java
Figure 12-6: The ServiceItem requested is returned to the Service Consumer and can be used locally.
Introduction
Chapter
1 - 12-7:
Introducing
Bluetooth on the Service Consumer, the Service Provider's service may
Figure
Once activated
Chapter
2 - Bluetooth
1.1 with the Service Provider device as part of the service offered.
communicate
directly
Chapter 3
- Before You Get Started
Figure
In an all-Bluetooth
Jini federation,
all the devices participating in the federation must be
Chapter
4 - 12-8:
Understanding
the Java Bluetooth
API
Bluetooth
enabled. This federation is wireless.
- Bluetooth with J2ME MIDP
Chapter 5
Chapter
6 - 12-9:
Creating
Bluetooth
Print Server
with JPS API
Figure
In aahybrid
Bluetooth
Jini federation,
at least one of the devices participating in the
Chapter
7
Java
and
OBEX
federation must be Bluetooth enabled. This federation is not (necessarily) wireless, and the JiniChapter
8 - Using a Bluetooth
Bluetooth-enabled
deviceSimulator
acts as a bridge between the Jini federation and an external Bluetooth
Chapter
9 - Bluetooth Security
piconet.
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Figure
TheBluetooth
PsiNode Applications
development
platform.
The Ericsson
Chapter
11 - 12-10:
Enterprise
with
the Ericsson
BlipNet Bluetooth module is covered by two
metal
andand
is connected
to the Dallas Semiconductor TINI microcontroller.
Chapter
12 -plates,
Bluetooth
Jini
Appendix A - javax.bluetooth
Appendix C: Java Bluetooth Development on the PalmOS Platform
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Figure
With
TDK Bluetooth Developer's Kit and the PalmOS emulator, you can develop,
Appendix
D - C-1:
BlipNet
1.1the
API
Indexdeploy, and test your Java Bluetooth applications all within the environment of your development
List ofmachine.
Figures
List of Tables
Figure C-2: The MIDP-Chat application
List of Listings
List of Sidebars
Bluetooth for Java
List of Tables
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
Apress © 2003 (352 pages)
Chapter 2: The
Bluetooth
1.1
authors of this
text describe how to develop wireless Java
applications using Bluetooth for a variety of platforms. This
includes Radio
an API Frequencies
overview of the Java library, development of
Table 2-1: Common
Bluetooth-based services, highlights of security concerns, and
more.
Table 2-2: Bluetooth Device Power Classes
Table 2-3: Layers of the Bluetooth Protocol Stack
Table of Contents
Bluetooth for Java
Chapter 3: Before You Get Started
Introduction
Chapter 1
- Introducing Bluetooth
Table
Classes
Chapter
2 -3-1:
Bluetooth
1.1in the javax.bluetooth Package
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Table 3-2: Classes in the javax.obex Package
Chapter
5 -3-3:
Bluetooth
with J2MESDK
MIDPVendors
Table
Java Bluetooth
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter
4: Understanding the Java Bluetooth API
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
Bluetooth Security
Table -4-1:
Bluetooth Discovery Modes
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter
Table
11 -4-2:
Enterprise
Bluetooth
Bluetooth
Major and
Applications
Minor Device
with the
Classes
Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Table 4-3: Common UUID Values for Bluetooth Protocol Layers
Appendix A - javax.bluetooth
Appendix
B -4-4:
javax.obex
Table
Common UUID Values for Bluetooth Profiles
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Chapter 7: Java and OBEX
Index
List of Figures
Table 7-1: OBEX Headers in the java.obex.HeaderSet Interface
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
List of Listings
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
Apress © 2003 (352 pages)
Chapter 4: The
Understanding
the Java
authors of this text describe
how to Bluetooth
develop wirelessAPI
Java
applications using Bluetooth for a variety of platforms. This
includes
an API overview
of the
the Atinav
Java library,
Listing 4-1: Stack
Initialization
Code for
SDK development of
Bluetooth-based services, highlights of security concerns, and
more.
Listing 4-2: BluetoothSetup1.java
Listing 4-3: DeviceProperties.java
Table of Contents
Bluetooth
for4-4:
JavaThe Service Registration Process
Listing
Introduction
Listing
OpeningBluetooth
Connections on a Bluetooth Server
Chapter
1 - 4-5:
Introducing
Chapter 2
- Bluetooth 1.1
- Before
You Get Startedwith J2ME MIDP
Chapter
5: Bluetooth
Chapter 3
Chapter 4
- Understanding the Java Bluetooth API
Chapter
5 - 5-1:
Bluetooth
with J2ME MIDP
Listing
Stealth.java
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Listing
Chapter
7 - 5-2:
JavaBeamTsk.java
and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Listing 5-3: PiconetMIDlet.java.
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 6: Creating a Bluetooth Print Server with JPS API
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Listing 6-1: JPSPrint.java
Appendix A - javax.bluetooth
Appendix
B - 6-2:
javax.obex
Listing
JPSBluetoothPrint.java
Appendix C - Java Bluetooth Development on the PalmOS Platform
Listing
JPSBluetoothPrintClient.java
Appendix
D - 6-3:
BlipNet
1.1 API
Index
Chapter 7: Java and OBEX
List of Figures
List of Tables
List ofListing
Listings
7-1: FTServer.java
List of Sidebars
Listing 7-2: FTClient.java
Chapter 8: Using a Bluetooth Simulator
Listing 8-1: mydevice.xml
Listing 8-2: ChatServer.java
Listing 8-3: ChatClient.java
Chapter 9: Bluetooth Security
Listing 9-1: Bank Account Information
Listing 9-2: A 1024-Bit Encryption Key
Listing 9-3: Bank Account Information Encrypted with the CAST Algorithm
Listing 9-4: ServerApp.java
Listing 9-5: ClientApp.java
Chapter 10:Bluetooth
Wireless
Embedded Systems with the Micro BlueTarget
for Java
by Bruce Hopkins and Ranjith Antony
ISBN:1590590783
Listing 10-1: Apress
L2CAPEchoServer.java
© 2003 (352 pages)
The authors of this text describe how to develop wireless Java
Listing 10-2: applications
L2CAPEchoClient.java
using Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Listing 10-3: Bluetooth-based
SPP2COMM.java
services, highlights of security concerns, and
more.
Chapter 11: Enterprise Bluetooth Applications with the Ericsson
Table
of Contents
BlipNet
Bluetooth for Java
Introduction
Listing 11-1: Tracking.java
Chapter 1 - Introducing Bluetooth
Chapter 2
- Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Chapter 6
- Creating a Bluetooth Print Server with JPS API
Chapter 7
- Java and OBEX
Chapter 8
- Using a Bluetooth Simulator
Chapter 9
- Bluetooth Security
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Chapter 12 - Bluetooth and Jini
Appendix A - javax.bluetooth
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix D - BlipNet 1.1 API
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
Bluetooth for Java
by Bruce Hopkins and Ranjith Antony
List of Sidebars
ISBN:1590590783
Apress © 2003 (352 pages)
authors of this text describe how to develop wireless Java
Chapter 2: The
Bluetooth
applications
using1.1
Bluetooth for a variety of platforms. This
includes an API overview of the Java library, development of
Bluetooth-based
services, highlights of security concerns, and
Bluetooth Profiles
vs. J2ME Profiles
more.
Chapter 5: Bluetooth with J2ME MIDP
Table of Contents
Bluetooth
for Java
Working
with the Example Code
Introduction
Chapter 1
- Introducing Bluetooth
Chapter
6: Creating a Bluetooth Print Server with JPS API
Chapter 2 - Bluetooth 1.1
Chapter 3
- Before You Get Started
Chapter 4
- Understanding the Java Bluetooth API
Chapter 5
- Bluetooth with J2ME MIDP
Printers and Print Services
Chapter
7: Java
and Print
OBEX
- Creating
a Bluetooth
Server with JPS API
Chapter 6
Chapter 7
- Java and OBEX
More
Connection
URLs
and the SDDB
Chapter
8 on
- Using
a Bluetooth
Simulator
Chapter 9
- Bluetooth Security
Chapter 8: Using a Bluetooth Simulator
Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget
Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet
Difference
Between
Simulator and an Emulator
Chapter
12 - Bluetooth
andaJini
Appendix A - javax.bluetooth
Chapter 9: Bluetooth Security
Appendix B - javax.obex
Appendix C - Java Bluetooth Development on the PalmOS Platform
Appendix
- BlipNet
1.1 API
MoreD on
Mobiwave
BPA-D10
Index
List of Figures
List of Tables
List of Listings
List of Sidebars