3. Rococo
Soft ware company based in Dublin, Ireland
Specialists in Java/Bluetooth since 2000
Sell tools and handset/embedded soft ware
100M+ units shipped
8. Bluetooth Architecture
UDP TCP
Audio
IP
Bluetooth Stack
PPP
OBEX
Service Discovery
RFCOMM
Protocol
Logical Link Control and Adaptation Protocol
Host Controller Interface
Host Controller Interface Firmware
Bluetooth Host
Link manager Protocol Controller
Baseband and
Baseband Link Controller Firmware
Bluetooth Radio
9. Bluetooth ProïŹles
Generic Access ProïŹle
SDAP TCS Bin based proïŹles
Intercom ProïŹle Cordless Phone
Serial Port ProïŹle
Generic Object Exchange
Dial Up Networking ProïŹle
File Transfer
Fax ProïŹle
Object Push
Headset ProïŹle
Synchronisation
LAN Access ProïŹle
10. Bluetooth and APIs
Bluetoothâs dirty little secret
Well ok, itâs not really a secret.....and itâs not that dirty
No Common API for Bluetooth Stacks
deïŹned as part of the Bluetooth standard
Why not?
Stacks were a pretty competitive area
in the early days of Bluetooth
Can create development issues
11. JSR82 aka JABWT
Provide Java APIs for ProïŹles supported :
common Bluetooth GAP, SDAP, SPP, GOEP,
functionality L2CAP, RFCOMM, SDP,
OBEX
Started Oct â00,
completed March â02
Generic Access ProïŹle
SDAP TCS Bin based proïŹles
Chaired by Motorola; Intercom ProïŹle Cordless Phone
other members
Serial Port ProïŹle
Generic Object Exchange
Dial Up Networking ProïŹle
included Rococo, Fax ProïŹle
File Transfer
Nokia, Ericsson, Headset ProïŹle
Object Push
Mitsubishi, Extended
Synchronisation
LAN Access ProïŹle
Systems and more
13. JSR82 Overview
Application
JSR82 APIs
OBEX
Service Discovery
RFCOMM
Protocol
Logical Link Control and Adaptation Protocol
Host Controller Interface
Host Controller Interface Firmware
Link manager Protocol
Baseband Link Controller
Bluetooth Radio
14. JSR82 Overview
Depends only on CLDC Two TCKs
Requires GCF Data-Centric (not
voice)
Two packages
(javax.obex and Asynchronous
javax.bluetooth) application start
(JSR118) - initially
Javax.obex not supported
javax.microedition.io
javax.bluetooth
15. JSR82 Overview
Manage and control
Device Management connections
Device Discovery <<uses>>
Ser vice Discovery
discovery
Ser vice Registration
<<uses>>
Connection Establishing connections
Using connections
16. Clients and Ser vers
Clients typically...
Discover Devices
Use Ser vice Discovery Protocol to query remote SDDB for ser vices
Connect and use required service(s)
Disconnect when ïŹnished
Servers typically...
Create a Service Record
Add Ser vice Record to Service Record Database
Wait for connections
Accept and process incoming connections
Update Ser vice Record when/if changes to the ser vices
De-register or disable Service Record when itâs no longer needed
May be both client and server....
17. Discovery : LocalDevice
javax.bluetooth::LocalDevice
discoveryAgent:DiscoveryAgent
localDevice:LocalDevice
LocalDevice(...)
getBluetoothAddress(...)
getDeviceClass(...)
getDiscoverable(...)
getDiscoveryAgent(...)
getFriendlyName(...)
getLocalDevice(...)
getProperty(...)
/** getRecord(...)
setDiscoverable(...)
* Initialize updateRecord(...)
*/
public void btInit() throws BluetoothStateException {
localDevice = null;
discoveryAgent = null;
// Retrieve the local device to get to the Bluetooth Manager
localDevice = LocalDevice.getLocalDevice();
// Clients retrieve the discovery agent
discoveryAgent = localDevice.getDiscoveryAgent();
}
Source: C. Enrique Ortiz - Using the Java APIs for Bluetooth, Part 2: Putting the Core APIs to Work
18. Discovery
DiscoveryAgent class used for both Device
and Ser vice Discovery
startInquiry() - non-blocking
specify a listener for the callbacks
retrieveDevices() - blocking
returns information about pre-known
devices (devices previously discovered)
19. Discovery
javax.bluetooth::DiscoveryListener
INQUIRY_COMPLETED: int
INQUIRY_ERROR: int
INQUIRY_TERMINATED: int
SERVICES_SEARCH_COMPLETED: int
SERVICES_SEARCH_DEVICE_NOT_REACHABLE: int
SERVICES_SEARCH_ERROR: int
SERVICES_SEARCH_NO_RECORDS: int
SERVICES_SEARCH_TERMINATED: int
deviceDiscovered(...)
inquiryCompleted(...)
servicesDiscovered(...)
servicesSearchCompleted(...)
implements
Client 1 1 Initiate and
uses javax.bluetooth::DiscoveryAgent Cancel device
discovery
CACHEC: int
GIAC:int
LIAC:int
NOT_DISCOVERABLE:int
PREKNOWN:int
DiscoveryAgent(...)
cancelInquiry(...) Callbacks on
cancelServiceSearch(...) DiscoveryListener
retrieveDevices(...) methods during
searchServices(...) inquiry
selectServices(...)
startInquiry(...)
20. Service Discovery
Search for services of a particular class
Retrieve service attributes of a service
Get services and their attributes in one go
Stop a ser vice search in progress
21. Connections
Based on GCF; Represented by L2CAPConnection
and StreamConnection types
Bluetooth Connections created using GCF
connection factory:
javax.microedition.io.Connector.open()
parameter = connectionURL
btl2cap://hostname [PSM | UUID]; parameters
btspp://hostname [CN | UUID]; parameters
hostname either localhost (server) or
BTAddr
22. Connections
...
// Bluetooth Service name
private static final String myServiceName = quot;MyBtServicequot;;
// Bluetooth Service UUID of interest
private static final String myServiceUUID = quot;2d26618601fb47c28d9f10b8ec891363quot;;
private UUID MYSERVICEUUID_UUID = new UUID(myServiceUUID, false);
...
// Define the server connection URL
String connURL = quot;btspp://localhost:quot;+MYSERVICEUUID_UUID.toString()
+quot;;quot;+name=quot;+myServiceName;
...
// Create a server connection (a notifier)
StreamConnectionNotifier scn = (StreamConnectionNotifier) Connector.open(connURL);
...
// Accept a new client connection
StreamConnection sc = scn.acceptAndOpen();
...
Source: C. Enrique Ortiz - Using the Java APIs for Bluetooth, Part 2: Putting the Core APIs to Work
23. Connections
...
// Given a service of interest, get its service record
ServiceRecord sr = (ServiceRecord)discoveredServices.elementAt(i);
// Then get the service's connection URL
String connURL = sr.getConnectionURL(ServiceRecord.NOAUTHENTICATE_NOENCRYPT, false);
// Open connection
StreamConnection sc = (StreamConnection) Connector.open(connURL);
...
Source: C. Enrique Ortiz - Using the Java APIs for Bluetooth, Part 2: Putting the Core APIs to Work
24. Wait for a connection
...
// Wait for client connection
StreamConnection conn = streamConnectionNotifier.acceptAndOpen();
// New client connection accepted; get a handle on it
RemoteDevice rd = RemoteDevice.getRemoteDevice(conn);
System.out.println(quot;New client connection... quot; +
rd.getFriendlyName(false));
// Read input message, in this example a String
DataInputStream dataIn = conn.openDataInputStream();
String s = dataIn.readUTF();
// Pass received message to incoming message listener
...
Source: C. Enrique Ortiz - Using the Java APIs for Bluetooth, Part 2: Putting the Core APIs to Work
25. Push Registry
Net work and timer-initiated midlet
activation
Inbound net work connection or timer-
based alarm can wake a midlet
midlet can register with Push Registry,
statically or dynamically
Example Use case: Health Care Monitor
26. Power Management
If an API is invoked that requires Bluetooth to be powered on, and enabled, then
JSR82
MUST Notify user
SHOULD Prompt user to activate
If user approves, Bluetooth MUST be activated (Powered on, Enabled)
Localdevice.isPowerOn()
NOT
RADIO / BT ENABLED
ENABLED
RADIO ON Proceed Notify
RADIO OFF Notify Notify
27. BCC Bluetooth Control
Center
Central authority for certain Bluetooth settings
MUST provide MAY provide
Device wide security settings Setting Device Name
Known devices Baseband timeouts
Trusted devices Reset device
Pairing mechanism Determining how connectable and
discoverable are set
Authorization of connection requests Enumerating ser vices on device
28. JSR82 Implementations
Phones Dev Kits OEM
Nokia Nokia
Symbian Sun
Motorola Atinav
Samsung Avetana
avelink
Sony Ericsson BlueCove
jsrsoft
Sharp jsrsoft
Rococo
Siemens Harald
BenQ javabluetooth.org
QTek Rococo
HTC
29. Rococoâs Approach
Support JSR82 from inception
Offer tools to developers
Simulator
DevKit
Offer implementation(s) to Equipment
Manufacturers
Initial interest: handset manufacturers
31. Current status of the
JSR82 standard
Now at JSR82 1.1
1.1 brought
Tidy ups
PushRegistry
32. Evolution of Bluetooth
Bluetooth SIG has been âbusyâ :-)
Embrace and Extend philosophy on short
range wireless standards
Some recent developments
WiBree and ULP
NFC
UWB
BECI
33.
34. WiBree and ULP
Nokia started working on low power
technology in 2001 (WiBree)
Idea was to address really low-power,
embedded connectivity scenarios
Watches, sensors, wearables
Successfully created the standard and
garnered industry participation
Merged in to Bluetooth 2007 - known for
now as ULP
35. Market potential - ULP
One connection within 50m every minute for three years on a single button cell battery
....within 5m every second for three years on a single button cell battery
Source:. Nick Hunn, EZurio, Bluetooth Evolution conference Nov 2007
40. UWB usage
HD Video (19 to 24 Mbps HD MPEG2); 18Gb
2 hour movie
up/download in 7 minutes ; 1% battery
1 CD Album (10 MP3s) - 1 second
20 Hi rez photos - 1 second
41. BECI
Bluetooth Embedded Control Interface
Standardise an interface above the level
of Bluetooth ProïŹles
Remove/reduce stack dependency
Focus: embedded / automotive markets
Potential for re-use in JSR82
42. Bluetooth Evolution
Lots of new stuff going in to Bluetooth
Standard
Java APIs may be needed to take
advantage of the new functionality
Bluetooth is moving from Phones (highest
volume) to Set Top Boxes, Cars, Copiers,
Printers, Medical Devices, .....
Lots of places where Java also lives :-)
43. Java and Bluetooth
Bluetooth Java
in devices in devices
Home Industrial / M2M
Gateway
Headsets
Medical
Sensors Phones
Printers STBs
Industrial / M2M Home
Gateway
Cars / OSGi Printers
44. JSR82 could do with
either...
A major update to track Bluetooth
Evolution
OR
A Brand new standard that builds on
JSR82
45. Issues - Current JSR82
Learning curve is still high
Piconets, Ser vices, Protocols, ProïŹles,
Security
Writing your own helper code every time:
e.g. Device Discovers and Ser vice
Searchers
e.g. Marge Project
https://marge.dev.java.net/
46. Enhancements
Housekeeping/Admin APIs
As per Marge
Better abstractions for ease of use
Audio
Application SpeciïŹc APIs
Gaming, Automotive, Location, Medical
UWB and Low-Power Scenarios
48. Conclusions
JSR82 is now âhitting its stride in terms
of usage and deployment
Excellent potential for follow-on standard
Either JSR82++
or a new standard that builds on it...
Rococo will propose such a standard in â08
Interested? Email me:
sos@rococosoft.com