▪
Bluetooth
▪
JSR 82
JSR 82 – Bluetooth APIs
▪
Umfangreiche Spezifikation unter:
▪
JSR 82 definiert optionale Pakete:
−
javax.bluetooth
−
javax.obex
Bluetooth Protokolle
Host Controller Interface Link Manager Protocol
Logical Link Control and Adaption Protocol
RS-232 serial connection over Bluetooth
Object Exchange Protocol Service Discovery Protocol
▪
Der BT-Transceiver
▪
LocalDevice
LocalDevice
▪
Instanz einer Repräsentation des BT-Geräts
−
LocalDevice.getLocalDevice()
▪
Eigenschaften des BT-Geräts
−
getBluetoothAddress()
−
getFriendlyName()
−
getDiscoverable()
−
getDeviceClass()
−
getProperty()
(siehe folgende Seite)
−
[isPowerOn()]
(ab JSR 82, v1.1, Absturz bei N95)
DeviceClass
▪
getServiceClasses()
▪
getMajorDeviceClass()
DeviceClass -
getServiceClasses()
0x002000 Limited Discoverable Mode
0x010000 Positioning (Location identification)
0x020000 Networking (LAN, Ad hoc, ...)
0x040000 Rendering (Printing, Speaker, ...)
0x080000 Capturing (Scanner, Microphone, ...)
0x100000 Object Transfer (v-Inbox, v-Folder, ...)
0x200000 Audio (Speaker, Microphone, Headset, ...)
0x400000 Telephony (Cordless telephony, Modem, ...)
DeviceClass -
getMajorDeviceClass()
0x0000 Miscellaneous
0x0100 Computer (desktop, notebook, PDA, ...)
0x0200 Phone (cellular, cordless, payphone, ...)
0x0300 LAN/Network Access point
0x0400 Audio/Video (headset, speaker, stereo, ...)
0x0500 Peripheral (mouse, joystick, keyboards, ..)
0x0600 Imaging (printing, scanner, camera, ...)
0x0700 Wearable
DeviceClass -
getMinorDeviceClass()
- Computer
▪
Major Device Class
0x0100
0x00 Uncategorized
0x04 Desktop workstation
0x08 Server-class computer
0x0C Laptop
0x10 Handheld PC/PDA (clam shell)
0x14 Palm sized PC/PDA
DeviceClass -
getMinorDeviceClass()
- Phone
▪
Major Device Class
0x0200
0x00 Uncategorized
0x04 Cellular
0x08 Cordless
0x0C Smart phone
0x10 Wired modem or voice gateway
DeviceClass -
getMinorDeviceClass()
- LAN AP
▪
Major Device Class
0x0300
0x00 Fully available 0x04 1 - 17% utilized 0x08 17 - 33% utilized 0x0C 33 - 50% utilized 0x10 50 - 67% utilized 0x14 67 - 83% utilized 0x18 83 - 99% utilized 0x1C No service available
DeviceClass -
getMinorDeviceClass()
- Audio/Video
▪
Major Device Class
0x0400
0x00 Uncategorized
0x04 Wearable Headset Device
0x08 Hands-free Device 0x0C Reserved 0x10 Microphone 0x14 Loudspeaker 0x18 Headphones 0x1C Portable Audio
DeviceClass -
getMinorDeviceClass()
- Audio/Video
▪
Major Device Class
0x0400
0x20 Car audio
0x24 Set-top box
0x28 HiFi Audio Device
0x2C VCR
0x30 Video Camera
0x34 Camcorder
0x38 Video Monitor
DeviceClass -
getMinorDeviceClass()
- Audio/Video
▪
Major Device Class
0x0400
0x40 Video Conferencing
0x44 Reserved 0x48 Gaming/Toy
DeviceClass -
getMinorDeviceClass()
- Peripheral
▪
Major Device Class
0x0500
−
Keyboard/Pointing Device field (may be combined
with lower bit fields in multifunctional devices)
0x00 Not Keyboard / Not Pointing Device
0x40 Keyboard
0x80 Pointing device
DeviceClass -
getMinorDeviceClass()
- Peripheral
▪
Major Device Class
0x0500
0x00 Uncategorized 0x04 Joystick 0x08 Gamepad 0x0C Remote control 0x10 Sensing device 0x14 Digitizer tablet
0x18 Card Reader (e.g. SIM Card Reader)
DeviceClass -
getMinorDeviceClass()
- Imaging
▪
Major Device Class
0x0600
0x00 Uncategorized
0x10 Display
0x20 Camera
0x40 Scanner
DeviceClass -
getMinorDeviceClass()
- Wearable
▪
Major Device Class
0x0700
0x04 Wrist Watch
0x08 Pager
0x0C Jacket
0x10 Helmet
DeviceClass -
getMinorDeviceClass()
- Toy
▪
Major Device Class
0x0800
0x04 Robot
0x08 Vehicle
0x0C Doll/Action Figure
0x10 Controller
▪
Device Discovery und
Service Search
▪
RemoteDevice
▪
DiscoveryAgent
DiscoveryAgent und DiscoveryListener
▪
Instanz eines DiscoveryAgents
− LocalDevice.getLocalDevice().getDiscoveryAgent()
▪
Device Discovery
− startInquiry(), cancelInquiry()▪
Service Search
− searchServices(), cancelServiceSearch(), selectService()▪
Cached und Preknown Remote Devices
− retrieveDevices()DiscoveryListener
Device Discovery
▪
DiscoveryAgent
− startInquiry(int accessCode, DiscoveryListener listener)
− cancelInquiry( DiscoveryListener listener )
▪
DiscoveryListener
− deviceDiscovered( RemoteDevice btDevice, DeviceClass cod )
Device Discovery - DiscoveryAgent
▪
startInquiry(
int accessCode, DiscoveryListener listener )
▪
Access Codes
−
DiscoveryAgent.GIAC
Device Discovery - DiscoveryListener
▪
deviceDiscovered( RemoteDevice rd, DeviceClass cod )▪
inquiryCompleted( int discType )RemoteDevice DeviceClass
Service Search (Service Discovery Protocol - SDP)
▪
DiscoveryAgent
− searchServices( int[] attrSet, UUID[] uuidSet, RemoteDevice dev, DiscoveryListener listener )
− cancelServiceSearch( int transID )
− selectService( UUID uuid, int security, boolean master )
▪
DiscoveryListener
− servicesDiscovered( int transID, ServiceRecord[] records )
Service Search - DiscoveryAgent
▪
searchServices( int[] attrSet, UUID[] uuidSet, RemoteDevice dev, DiscoveryListener listener )▪
Abfrage aller vom RemoteDevice
devzur Verfügung
gestellten Services, die alle in
uuidSetvorhandene
UUIDs in dem entsprechenden SDDB-Eintrag enthält.
▪
attrSet: Attribute, die zusätzlich zu den
Default-Attributen in den aufgrund des
searchServices()Requests in den Aufrufen der Method
servicesDiscovered()
des
listenerObjekts in den
Default-Attribute
Service Search – BT Service Attributes
▪
Wichtige Service-Attribute (BT Assigned Numbers)
Quelle: JSR 82 JavaDoc für das Interface ServiceRecord der Forum Nokia Library (http://library.forum.nokia.com/)
Base attribute ID value for the primary language is 0x0100
UUIDs – Universally Unique Identifier
▪
Wichtige UUIDs für Protokolle und Serviceklassen
(BT Assigned Numbers)
Quelle: JSR 82 JavaDoc für die Klasse UUID der
Service Search - DiscoveryAgent
▪
searchServices( int[] attrSet, UUID[] uuidSet, RemoteDevice dev, DiscoveryListener listener )Service Search – DiscoveryListener
▪
servicesDiscovered(int transID, ServiceRecord[] records )
▪
serviceSearchCompleted( int transID, int code )ServiceRecord und DataElement
▪
ServiceRecord
− getAttributeIDs() − getAttributeValue( int attrID ) − getConnectionURL( int requiredSecurity, boolean mustBeMaster ) DataElement▪
DataElement
▪
BT-Verbindungen
(Server und Client)
▪
Generic Connection Framework
▪
DiscoveryAgent
BT-Server – Generic Connection Framework (GCF)
▪
Server Loop
− javax.microedition.io.Connector
− open( String url )
− acceptAndOpen() StreamConnection StreamConnectionNotifier
BT-Server – Generic Connection Framework (GCF)
BT-Client – Generic Connection Framework (GCF)
▪
Verbindungsaufbau mit der URL, die vom entsp.
ServiceRecord der Servicesuche bekannt ist
− javax.microedition.io.Connector