ALL RIGHTS RESERVED UNDER JSPA (JAVA SPECIFICATION PARTICIPATION AGREEMENT)
Java
TM
APIs for Bluetooth
TM
Wireless Technology (JSR-82)
Specification Version 1.0a
Java
TM
2 Platform, Micro Edition
Motorola
Wireless Software, Applications & Services
6501 William Cannon Drive West
MD: OE112
Austin, TX 78735-8598
1.0a, April 5, 2002
ALL RIGHTS RESERVED UNDER JSPA (JAVA SPECIFICATION PARTICIPATION AGREEMENT)
April 5, 2002 Java APIs for Bluetooth Wireless Technology (JSR-82)
ii
Java and Java-based trademarks and logos are trademarks of Sun Microsystems, Inc.
Bluetooth is a trademark owned by Bluetooth SIG, Inc.
All other trademarks are the property of their respective owners.
© Sun Microsystems, Inc., 2001, 2002. All rights reserved.
ALL RIGHTS RESERVED UNDER JSPA (JAVA SPECIFICATION PARTICIPATION AGREEMENT)
April 5, 2002 Java APIs for Bluetooth Wireless Technology (JSR-82)
iii
CONTENTS
Preface viii
Revision History................................................................................................................................. viii
Who Should Use This Specification ................................................................................................. viii
How This Specification Is Organized .............................................................................................. viii
Chapter 1 Introduction and Background ............................................................................. 1
1.1 Introduction.....................................................................................................................1
1.2 Background......................................................................................................................1
1.2.1 Bluetooth Specification ...................................................................................................................1
1.2.2 JSR-82 Expert Group ......................................................................................................................2
1.3 Document Conventions...................................................................................................2
1.4 Formatting Conventions.................................................................................................3
Chapter 2 Goals, Requirements, and Scope ......................................................................... 4
2.1 Goals.................................................................................................................................4
2.2 Requirements...................................................................................................................4
2.2.1 Specification Definition Requirements............................................................................................4
2.2.2 Device Requirements) .....................................................................................................................5
2.2.3 Bluetooth System Requirements......................................................................................................5
2.2.4 Usage Cases.....................................................................................................................................5
2.3 Scope.................................................................................................................................6
Chapter 3 Architecture ..........................................................................................................8
3.1 Overview ..........................................................................................................................8
3.2 Overview of Bluetooth Protocol Stack..........................................................................8
3.3 Architecture of the API ................................................................................................10
3.3.1 Packages ........................................................................................................................................11
3.3.2 MIDP and Bluetooth API ..............................................................................................................11
3.3.3 Bluetooth Control Center...............................................................................................................12
3.3.3.1 BCC and Security Mode................................................................................................................12
3.3.3.2 BCC Features ................................................................................................................................13
3.3.4 Device Properties ..........................................................................................................................13
3.3.5 Client and Server Model................................................................................................................14
PART A – DISCOVERY ............................................................................................................ 16
Chapter 4 Device Discovery................................................................................................. 17
4.1 Introduction...................................................................................................................17
4.2 Device Discovery Classes..............................................................................................17
4.2.1 interface javax.bluetooth.DiscoveryListener .................................................................................17
4.2.2 class javax.bluetooth.DiscoveryAgent...........................................................................................17
ALL RIGHTS RESERVED UNDER JSPA (JAVA SPECIFICATION PARTICIPATION AGREEMENT)
April 5, 2002 Java APIs for Bluetooth Wireless Technology (JSR-82)
iv
Chapter 5 Service Discovery................................................................................................ 19
5.1 Introduction...................................................................................................................19
5.2 API Overview ................................................................................................................19
5.3 Service Discovery Classes.............................................................................................19
5.3.1 class javax.bluetooth.UUID...........................................................................................................20
5.3.2 class javax.bluetooth.DataElement ................................................................................................20
5.3.3 interface javax.bluetooth.ServiceRecord .......................................................................................20
5.3.4 class javax.bluetooth.DiscoveryAgent...........................................................................................20
5.3.5 interface javax.bluetooth.DiscoveryListener .................................................................................20
5.4 Example Code................................................................................................................21
Chapter 6 Service Registration............................................................................................ 32
6.1 Introduction...................................................................................................................32
6.2 Responsibilities for Service Registration ....................................................................32
6.3 Connect-Anytime Services ...........................................................................................33
6.4 Connectable and Non-Connectable Modes.................................................................34
6.5 Classes ............................................................................................................................35
6.5.1 interface javax.bluetooth.ServiceRecord .......................................................................................35
6.5.2 class javax.bluetooth.LocalDevice ................................................................................................36
6.5.3 class javax.bluetooth.ServiceRegistrationException extends java.io.IOException .......................37
PART B – DEVICE MANAGEMENT...................................................................................... 38
Chapter 7 Generic Access Profile ....................................................................................... 39
7.1 Introduction...................................................................................................................39
7.2 GAP Classes...................................................................................................................39
7.2.1 class javax.bluetooth.LocalDevice ................................................................................................39
7.2.2 class javax.bluetooth.RemoteDevice .............................................................................................39
7.2.3 class javax.bluetooth.BluetoothStateException extends java.io.IOException...............................39
7.2.4 class javax.bluetooth.DeviceClass.................................................................................................40
Chapter 8 Security ............................................................................................................... 41
8.1 Introduction...................................................................................................................41
8.2 Security Requests in the Connection String ...............................................................41
8.2.1 Server Requests for Authentication ...............................................................................................41
8.2.2 Server Requests for Encryption.....................................................................................................42
8.2.3 Server Requests for Authorization.................................................................................................43
8.2.4 Server Requests for Master Role ...................................................................................................43
8.2.5 Client Requests in the Connection String ......................................................................................44
8.3 Security Classes.............................................................................................................45
8.3.1 class javax.bluetooth.RemoteDevice .............................................................................................45
8.4 Server Application Security .........................................................................................45
8.5 Client Application Security..........................................................................................46
8.6 Security Changes After Connection Establishment...................................................47
ALL RIGHTS RESERVED UNDER JSPA (JAVA SPECIFICATION PARTICIPATION AGREEMENT)
April 5, 2002 Java APIs for Bluetooth Wireless Technology (JSR-82)
v
PART C – COMMUNICATION................................................................................................ 51
Chapter 9 Serial Port Profile............................................................................................... 52
9.1 Introduction...................................................................................................................52
9.2 API Overview ................................................................................................................52
9.3 SPP Server and Client Connection URLs...................................................................52
9.4 Serial Port Service Registration ..................................................................................53
9.5 Connection Establishment............................................................................................54
9.5.1 Server Connection Establishment..................................................................................................54
9.5.2 Client Connection Establishment...................................................................................................56
9.6 SPP Service Records .....................................................................................................56
9.6.1 SPP Service Record Modification .................................................................................................59
9.6.2 Restrictions on Modifying Service Records ..................................................................................60
9.6.3 Device Service Classes..................................................................................................................61
9.7 Example Code................................................................................................................61
9.7.1 Client Application .........................................................................................................................62
9.7.2 Server Application.........................................................................................................................63
9.7.3 Service Record Modification.........................................................................................................64
Chapter 10 Logical Link Control and Adaptation Protocol (L2CAP) ................................ 69
10.1 Introduction...................................................................................................................69
10.2 API Overview ................................................................................................................69
10.2.1 Channel Configuration...................................................................................................................70
10.2.1.1 Maximum Transmission Unit (MTU).........................................................................................71
10.3 L2CAP Connection Interface.......................................................................................72
10.3.1 L2CAP Server and Client Connection URLs ...............................................................................72
10.3.2 L2CAP Service Record .................................................................................................................74
10.4 L2CAP Connection Classes..........................................................................................76
10.4.1 interface javax.bluetooth.L2CAPConnection extends javax.microedition.io.Connection .............76
10.4.2 interface javax.bluetooth.L2CAPConnectionNotifier extends javax.microedition.io.Connection.76
10.4.3 class javax.bluetooth.BluetoothConnectionException extends java.io.IOException.....................77
10.5 Example Code................................................................................................................77
10.5.1 Client Application .........................................................................................................................77
10.5.2 Server Application.........................................................................................................................79
Chapter 11 Object Exchange Protocol (OBEX)................................................................... 80
11.1 Introduction...................................................................................................................80
11.2 OBEX Overview............................................................................................................80
11.3 API Overview ................................................................................................................81
11.3.1 Client Connection..........................................................................................................................83
11.3.2 Server Connection .........................................................................................................................84
11.4 Connection String Description.....................................................................................84
11.4.1 OBEX Over RFCOMM.................................................................................................................85
11.4.2 OBEX Over TCP/IP ......................................................................................................................86
- 1
- 2
前往页