blipnet api jan justesen software designer [[email protected]]

74
BlipNet API Jan Justesen Software Designer [[email protected]]

Post on 21-Dec-2015

218 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

BlipNet API

Jan JustesenSoftware Designer

[[email protected]]

Page 2: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

Agenda

• BlipNet API features

• Implementation Details

• Positioning with BlipNet

• Building End2End Solutions

Page 3: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

BlipNet API Features

BlipNet API featuresImplementation DetailsPositioning with BlipNetBuilding End2End Solutions

Page 4: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

BlipNet API Features

• Dynamic Configuration of BlipNodes• Bluetooth Device Discovery• Service Discovery on Bluetooth Devices• Connection Establishment and Monitoring• Interaction with Services on other Devices• Monitoring Client Usage of BlipNet provided services• Serial Port Server Service

Page 5: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

Dynamic BlipNode Configuration

• Friendly Name• Discoverability and Connectability Settings• Security Mode• Output Power Control• Link Status Measurement Settings

• Lots of other Advanced Bluetooth Settings AFH Channel Map Inquiry and Page Scan Settings ...... See API documentation for more

Page 6: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

BlipNet API Features

• Dynamic Configuration of BlipNodes• Bluetooth Device Discovery• Service Discovery on Bluetooth Devices• Connection Establishment and Monitoring• Interaction with Services on other Devices• Monitoring Client Usage of BlipNet provided services• Serial Port Server Service

Page 7: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

Bluetooth Device Discovery

• Detect other Bluetooth Devices in range of the BlipNode

• Inquiry Events include Bluetooth Address Clock Information for accelerated Paging RSSI Value

• Enable Name Lookup to get Friendly Names of Detected devices Serious impact on frequency of detection in continous inquiry

Application BlipServer

Page 8: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

BlipNet API Features

• Dynamic Configuration of BlipNodes• Bluetooth Device Discovery• Service Discovery on Bluetooth Devices• Connection Establishment and Monitoring• Interaction with Services on other Devices• Monitoring Client Usage of BlipNet provided services• Serial Port Server Service

Page 9: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

Service Discovery (SDP)

• Discover Available Services on a Bluetooth Device

• Service Browsing List available services on Device

• Service Discovery Read Entire Service Record

Service Name Service Description and much more...

• It is possible to identify device type in some cases

Page 10: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

BlipNet API Features

• Dynamic Configuration of BlipNodes• Bluetooth Device Discovery• Service Discovery on Bluetooth Devices• Connection Establishment and Monitoring• Interaction with Services on other Devices• Monitoring Client Usage of BlipNet provided services• Serial Port Server Service

Page 11: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

Connection Establishment - Clock Sync

• Application can control Connection Establishment

• Use ConnectData from Inquiry Events to decrease Paging Time ~ 200 ms

• Pseudo Clock synchronization betweenBlipNodes enables fast connectionsetup even with shared ConnectData

Sequence:

1. Inquiry result (Bluetooth adr, Clock info).

2. Connect (Bluetooth adr, Clock info)

BlipServer

Application

Page 12: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

Connection Establishment - Power Control

• Power can be controlled for two phases: Paging/Inquiry phase ACL link phase

• Range can be controlled, via output power, from 100 to 0 meter.

Application BlipServer

Zone for active ACL link,

Determined by Link Power

Zone for Inquiry/Paging

Determined by Link Establishment Power

Page 13: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

Connection Establishment - new Features

• Monitor Status of Active Links RSSI and BER (and AFH Channel Map)

• BlipServer automatically manages Connections for multiple applications

Page 14: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

BlipNet API Features

• Dynamic Configuration of BlipNodes• Bluetooth Device Discovery• Service Discovery on Bluetooth Devices• Connection Establishment and Monitoring• Interaction with Services on other Devices• Monitoring Client Usage of BlipNet provided services• Serial Port Server Service

Page 15: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

Interaction with Services on other Devices

• Profile Package for each of the BlipNode Client Profiles ProfileHandler EventListener interface Event interface Any Additional Profile Specific Classes

• Supported Profiles OBEX Object Push OBEX File Transfer Serial Port

• NAP Invoked PAN Sessions

Page 16: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

BlipNet API Features

• Dynamic Configuration of BlipNodes• Bluetooth Device Discovery• Service Discovery on Bluetooth Devices• Connection Establishment and Monitoring• Interaction with Services on other Devices• Monitoring Client Usage of BlipNet provided services• Serial Port Server Service

Page 17: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

Monitoring BlipNet Services

• Event Based Monitoring Client Connections and Service usage Sesssion Statistics for each Session

Start and End Time Bytes Sent and Received

• BlipNet Provides Object Push Server File Transfer Server Serial Port Server PAN Server LAP Server (deprecated profile)

• Add eventlisteners to BlipServerConnection for BlipNet wide monitoring

Page 18: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

BlipNet API Features

• Dynamic Configuration of BlipNodes• Bluetooth Device Discovery• Service Discovery on Bluetooth Devices• Connection Establishment and Monitoring• Interaction with Services on other Devices• Monitoring Client Usage of BlipNet provided services• Serial Port Server Service

Page 19: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

Serial Port Server Service

• Application Registers Service on BlipNode

• SerialPort API same as SPP Client

Page 20: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

Implementation Details

BlipNet API featuresImplementation DetailsPositioning with BlipNetBuilding End2End Solutions

Page 21: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

Implementation Details

• BlipServer Architecture• Event Model• BlipNet API Structure• Inquiry• Connection Management and Monitoring• Client Profile APIs

Page 22: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

...

BlipServer Architecture

BlipServerConnection(Stub)

BlipServerConnection(Implementation)

BlipNodeHandle(Stub)

EventListener(Implementation)

EventListener(Stub)

DB

ConnectionHandler

InquiryHandler

ProfileHandlers

Model

RMIMAL / TCP

BlipNodeHandle(Implementation)

BlipNodeComponents

EventDispatcher

JDBC

Page 23: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

Implementation Details

• BlipServer Architecture• Event Model• BlipNet API Structure• Inquiry• Connection Management and Monitoring• Client Profile APIs

Page 24: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

Event Model

• Generic Event Interface Defines Event Classes

• Extended Event Interface for each event class Defines Event Types Getter methods for event related data

Note! Not all data included in all event types

• EventHandler interface for each event class Defines handleXxxxEvent() method

• Filtering BlipNode Bluetooth Address Terminal Bluetooth Address EventID

Page 25: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

Event Dispatch Implementation

• On the Server Side Single Threaded Event Dispatcher

Dispatches events sequentially to all registered listeners Separate Dispatcher for Inquiry Events

• On the Client Side Single Threaded Event Queue for each Listener

Multiple Listeners on client side may be called concurrently

LocalEventQueue Event Dispatcher

WorkerEvent Listener Implementation

2: Get

1: insert

3: handleEvent

Page 26: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

Implementation Details

• BlipServer Architecture• Event Model• BlipNet API Structure• Inquiry• Connection Management and Monitoring• Client Profile APIs

Page 27: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

BlipNet API Structure

BlipServerConnectionBlipServerConnection

BlipNodeHandleBlipNodeHandleBlipNodeHandleBlipNodeHandleBlipNodeHandleBlipNodeHandle

ConnectionHandlerConnectionHandler InquiryHandlerInquiryHandlerProfileHandlerProfileHandler

OPPOPP FTPFTP PANPANFTPFTP

Page 28: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

BlipNet API Packages

• com.blipsystems.blipnet.api.blipserver Static factory class for getting connections to the server BlipServerConnection interface

• com.blipsystems.blipnet.api.blipnode Classes and Interfaces for interacting with BlipNodes

• com.blipsystems.blipnet.api.event General Event definitions and handlers

• com.blipsystems.blipnet.api.profile Sub-package for each profile

Profile Specific events and eventlisteners Profile Specific classes and interfaces

• com.blipsystems.blipnet.api.bluetooth Bluetooth related support classes

Page 29: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

The BlipServerConnection

• The applications entry-point to the BlipServer

• Restricted Access Username / Password / Hostname

• Functionality Add remove global event listeners Get status information from server Get access to BlipNodes

Page 30: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

The BlipNodeHandle

• One to One mapping to physical BlipNodes

• Locking mechanism for exclusive access to BlipNode Settings and Inquiry Create ShutdownHook to ensure release!

- Runtime.addShutdownHook(Thread hook);

• Functionality Reading status information for the BlipNode Managing dynamic configuration settings Adding/Removing event listeners Access to Handlers for Logical groupings of functionality

InquiryHandler ConnectionHandler WirelessHandler ProfileHandlers – SDP(c), OPP(c), FTP(c), SPP(c), SPP(s), PAN(”s”)

Page 31: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

Getting the BlipNodeHandles

import com.blipsystems.blipnet.blipserver.*;

import com.blipsystems.blipnet.blipnode.*;

try {

BlipServerConnection server = BlipServer.getConnection(user,pass,host);

BlipNodeHandle[] handles = server.getBlipNodeHandles(blipnode_group,

config_group,

incl_reserved,

incl_disconnected);

} catch (BlipServerConnectionException e) {

// Communication problems

} catch (BlipServerAccessException e) {

// Invalid username/password

}

Page 32: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

Implementation Details

• BlipServer Architecture• Event Model• BlipNet API Structure• Inquiry• Connection Management and Monitoring• Client Profile APIs

Page 33: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

Inquiry

• InquiryHandler Setting Inquiry Filters Starting and Stopping Inquiry

• InquiryData Inquiry Period, Inquiry Interval

(Note! ~90% hit-rate within 5-6 seconds) Enable RSSI measurement Enable Name Lookup Enable Continuous Inquiry

• InquiryEvent Bluetooth Address of Device RSSI value ConnectData with Clock Information

Page 34: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

Inquiry Filtering

• Filtering on Class Of Device Enables search for certain types of devices

Phone, Laptop, PDA, Peripheral, etc. and/or devices that support specific features

Networking, Rendering, Object Transfer, Audio, etc.

• Filtering on Bluetooth Address Ignore detections of a certain BluetoothAddress

Possible to specify timeout Useful for automated periodic actions towards detected devices

Page 35: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

Inquiry Procedure

• Inquiry Result Events for all detected terminals

• Inquiry Complete Event (when Inquiry Period is over)

• If name lookup is enabled:

Friendly Name Detected events for detected terminals on which name lookup succeeds

Name Lookup Complete event when name lookup is done

• If Continous Inquiry Enabled Start next Inquiry Period

Page 36: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

Application Steps

• Register InquiryEventListener On Server or on BlipNode

• Start Inquiry on BlipNode Configure Inquiry Period length and interval Measure RSSI? Lookup friendly-names?

• EventListener will get an event each time a terminal is detected Multiple detections in one inquiry period (especially 1.2 devices)

Page 37: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

Setting Inquiry Filter

InquiryHandler inquiry = blipnodeHandle.getInquiryHandler();

PhoneClassOfDevice phoneCOD =

new PhoneClassOfDevice(

PhoneClassOfDevice.MINOR_CLASS_SMART_PHONE);

phoneCOD.setObjectTransfer(true);

ComputerClassOfDevice compCOD =

new ComputerClassOfDevice(

ComputerClassOfDevice.MINOR_CLASS_PALM_SIZED_PC_OR_PDA);

inquiry.setInquiryFilter(new GenericClassOfDevice[] {phoneCOD, compCOD});

Page 38: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

Starting Inquiry

InquiryHandler inquiry = blipnodeHandle.getInquiryHandler();

// ...

inquiry.setInquiryFilter(new GenericClassOfDevice[] {phoneCOD, compCOD});

InquiryData inquiryData = new InquiryData(5, 0);

inquiryData.setContinousInquiryEnabled(true);

inquiryData.setRssiMeasurementEnabled(true);

inquiry.startInquiry(inquiryData);

Page 39: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

The InquiryEventListener

public class Foo implements InquiryEventListener { public void handleInquiryEvent(InquiryEvent evt) { int eventID = evt.getEventID(); BluetoothAddress terminalID; switch (eventID) { case InquiryEvent.TERMINAL_DETECTED: terminalID = evt.getTerminalID(); ConnectData connectData = evt.getConnectData(); int rssi = evt.getRssiResult()[0]; // Do something break; case InquiryEvent.FRIENDLY_NAME_DETECTED: terminalID = evt.getTerminalID(); String friendlyName = evt.getFriendlyName(); // Do something break; case InquiryEvent.INQUIRY_COMPLETE: case InquiryEvent.NAME_LOOKUP_COMPLETE: } }}

Page 40: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

Implementation Details

• BlipServer Architecture• Event Model• BlipNet API Structure• Inquiry• Connection Management and Monitoring• Client Profile APIs

Page 41: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

Connection Management

• Bluetooth Connections can be managed manually by application or automatically by BlipServer

• Use ConnectionHandler to manually control Bluetooth Links

• Use ProfileHandlers directly, and let BlipServer manage links and sessions

BlipServer Managed Links are kept active as long as there are sessions running on the Connection

Manually established links become ”Managed” when link owner requests disconnect

Page 42: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

Connection Status Monitoring

• Read RSSI and BER on active Links RSSI affected by Golden Receiver Range BER should be < 0.1% for a workable link

• Configurable Measurement interval > 100 ms

• Status Readings are sent to ConnectionEventListeners CONNECTION_STATUS event

Page 43: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

Connection Status Monitoring

public class StatusMonitor implements ConnectionEventListener { public static void main(String[] args) { new StatusMonitor(); }

public StatusMonitor() { try { // ... blipNodeHandle.getConnectionHandler().addEventListener(this); } catch (BlipServerConnectionException e) { } }

public void handleConnectionEvent(ConnectionEvent evt) { int eventID = evt.getEventID(); BluetoothAddress terminalID = evt.getTerminalID();

if (eventID == ConnectionEvent.CONNECTION_STATUS) { int rssi = evt.getRssiResult()[0]; double ber = evt.getBitErrorRate()[0]; } }}

Page 44: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

Implementation Details

• BlipServer Architecture• Event Model• BlipNet API Structure• Inquiry• Connection Management and Monitoring• Client Profile APIs

Page 45: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

Object Push Profile (OPP)

• OBEX Based

• Defines Three Operations:

• Push Send any kind of object to OPP Server Device

Server may reject certain object types• Business Card Pull

Pull default business card from OPP server device No other objects can be ”pulled”

• Business Card Exchange Exchange Business Cards with OPP Server Device Combined Pull’n’Push

Page 46: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

OPP Client ClassesProfileHandler

interfaceOppClientHandler

+addEventListener:void+addEventListener:void+removeEventListener:void+push:void+push:void+exchangeBusinessCards:void+pullBusinessCard:void+pushBusinessCard:void+searchServices:void+abortCurrentOperation:void

businessCard:String

ProfileExceptionOppException

SerializableObexResponseCode

TerminalEventinterface

OppClientEvent

+OBEX_PUSH_COMPLETED:int+OBEX_PUSH_FAILED:int+OBEX_BUSINESS_CARD_PULL_COMPLETED:int+OBEX_BUSINESS_CARD_PULL_FAILED:int+OBEX_BUSINESS_CARD_EXCHANGE_COMPLETED:int+OBEX_BUSINESS_CARD_EXCHANGE_FAILED:int+OBEX_CLIENT_AVAILABLE_SERVICENAMES:int+OBJECT_FRAGMENT_RECEIVED:int+OBEX_CLIENT_AVAILABLE_SERVICENAMES_FAILED:int

pushobjects

+ObexPushObject+ObexFile+WapServiceLoading+ObexGenericObject+WapServiceIndication+EricssonMelody+ObexServerHostedFile

TerminalEventinterface

ObexProgressEvent

+OBEX_PUSH_PROGRESS:intinterfaceObexProgressListener

+newProgress:void

interfaceOppClientEventListener

+handleOppClientEvent:void

Page 47: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

OPP Client Sample

• Connect to OPP Server Device• Push a .jpg file• Disconnect

public class OppSample implements OppClientEventListener {

// Initiate operation

public void connect() {}

// Implement Event Listeners

public void handleOppClientEvent(OppClientEvent evt) {}

}

Page 48: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

OPP Client Sample

Object1

initialOppClientSample

try

if(blipNodeHandles.length > 0)

catch(IOException e)

catch(OppException e)

catch(BlipServerConnectionException e)

catch(BlipServerAccessException e)

staticBlipServer

serverBlipServerConnection

handleBlipNodeHandle

connectDataConnectData

filterEventFilter

pushObjectObexFile

handlerOppClientHandler

try

if(blipNodeHandles.length > 0)

catch(IOException e)

catch(OppException e)

catch(BlipServerConnectionException e)

catch(BlipServerAccessException e)

1.1.3.7: push(connectData, pushObject):void

1.1.3.6: addEventListener(this, filter):void

1.1.3.5: <constructor>(new File("image.jpg"))

1.1.3.4: <undefined>(null, new BluetoothAddress[]{connectData.get...

1.1.3.3: getTerminalID():com.blipsystems.blipnet.api.bluetooth.Bluet...

1.1.3.2: <constructor>("AABBCCDDEEFF")

1.1.3.1: handler:=getOppClientHandler():com.blipsystems.blipnet.a...

1.1.2: blipNodeHandles:=getBlipNodeHandles("groupName", "confi...

1.1.1: server:=getConnection("sample", "sample", "localhost"):com...

1: connect():void

Page 49: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

OPP Client Sample

Object1

initialOppClientSample

if(eventID == OppClientEvent.OBEX_PUSH_COMPLETED)

else

if(eventID == OppClientEvent.OBEX_PUSH_FAILED)

try

catch(BlipServerConnectionException e)

evtOppClientEvent

handlerOppClientHandler

if(eventID == OppClientEvent.OBEX_PUSH_COMPLETED)

else

if(eventID == OppClientEvent.OBEX_PUSH_FAILED)

try

catch(BlipServerConnectionException e)

1.4.1: removeEventListener(this):void

1.3.1.1: getCause():int

1.1: eventID:=getEventID():int

1: handleOppClientEvent(OppClientEvent):void

Page 50: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

File Transfer Profile (FTP)

• OBEX Based

• Defines Six Operations:

• Push Push any kind of object to server device

• Pull Pull any kind of object from server device

• Delete Delete object from server device

• Set Path Change the current folder on server device

• Folder Listing List files and sub-folders in current folder on server device

• Create Folder Create a new folder on server device

Page 51: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

File Transfer Profile

• NOTE! On connect, current folder is alway root folder on the device

• All operations are performed in the current folder on the server device Must use manual session control if using Set Path operation

Page 52: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

File Transfer ClassesTerminalEvent

interfaceFtpClientEvent

+AVAILABLE_SERVICE_NAMES:int+PATH_CHANGED:int+PATH_CHANGE_FAILED:int+FOLDER_CREATED:int+FOLDER_CREATION_FAILED:int+FOLDER_LISTING:int+FOLDER_LISTING_FAILED:int+OBJECT_SENT:int+OBJECT_PUSH_FAILED:int+OBJECT_RECEIVED:int+OBJECT_PULL_FAILED:int+OBJECT_DELETED:int+OBJECT_DELETION_FAILED:int+OBJECT_FRAGMENT_RECEIVED:int+AVAILABLE_SERVICE_NAMES_FAILED:int

ProfileHandlerinterface

FtpClientHandler

+addEventListener:void+addEventListener:void+removeEventListener:void+searchServices:void+setPath:void+setPath:void+createFolder:void+requestFolderListing:void+requestFolderListing:void+putObject:void+putObject:void+getObject:void+getObject:void+deleteObject:void+abortCurrentOperation:void

interfaceFtpClientEventListener

+handleFtpClientEvent:void

Serializableinterface

FtpFileDescriptor

name:String size:long type:String displayName:String folder:boolean modified:Date created:Date accessed:Date userPermissions:Permissions groupPermissions:Permissions otherPermissions:Permissions owner:String group:String

Serializableinterface

FtpFolderListing

+hasParentFolder:boolean

files:FtpFileDescriptor[] folders:FtpFileDescriptor[]

ProfileExceptionFtpException

Page 53: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

Serial Port Profile (SPP)

• Serial Cable Replacement Transfer Serial data over Bluetooth

• Supported by Bluetooth Enabled phones, PDAs, Computers, and Industrial Devices

• BlipNet API provides BluetoothSerialPort

Page 54: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

Serial Port Profile Classes

ProfileHandlerinterface

SppClientHandler

+addEventListener:void+addEventListener:void+removeEventListener:void+searchServices:void+establishSession:void+establishDunClientSession:void+removeDunClientSession:void

interfaceSppClientEventListener

+handleSppClientEvent:void

TerminalEventinterface

SppClientEvent

+SERIAL_PORT_READY:int+SPP_CLIENT_AVAILABLE_SERVICENAMES:int+SPP_CLIENT_AVAILABLE_SERVICENAMES_FAILED:int

InputStreamSerializable

SppInputStream

OutputStreamSerializable

SppOutputStreamSerializable

interfaceBluetoothSerialPort

+addEventListener:void+removeEventListener:void

inputStream:SppInputStream outputStream:SppOutputStream

ProfileExceptionSppException

interfaceSerialPortEventListener

+serialEvent:void

Serializableinterface

SerialPortEvent

+DATA_AVAILABLE:int+OUTPUT_BUFFER_EMPTY:int

Page 55: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

SPP Client Sample

• Connect to SPP Server Device• Read up to 200 bytes data• Echo the data back to the Server• Disconnect

public class SppSample implements SppClientEventListener, SessionEventListener {

// Request serial port

public void connect(BlipNodeHandle handle) {}

// Implement Event Listeners

public void handleSppClientEvent(SppClientEvent evt) {}

public void handleSessionEvent(SessionEvent evt) {}

}

Page 56: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

SPP Client Sample

Object1

initialOppClientSample

try

catch(BlipServerConnectionException e)

catch(SppException e)

handleBlipNodeHandle

connectDataConnectData

filterEventFilter

handlerSppClientHandler

try

catch(BlipServerConnectionException e)

catch(SppException e)

1.1.7: establishSession(connectData):void

1.1.6: addEventListener(this, filter):void

1.1.5: <undefined>(null, new BluetoothAddress[]{connectData.getTe...

1.1.4: getTerminalID():com.blipsystems.blipnet.api.bluetooth.Bluetoo...

1.1.3: <constructor>("AABBCCDDEEFF")

1.1.2: handler:=getSppClientHandler():com.blipsystems.blipnet.api....

1.1.1: addSessionEventListener(this):void

1: connect(BlipNodeHandle):void

Page 57: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

SPP Client Sample

Object1

initialOppClientSample

try

if(bytesRead != -1)

catch(BlipServerConnectionException e)

catch(IOException e)

try

catch(BlipServerConnectionException e)

catch(ProfileException e)

handlerSppClientHandler

evtSppClientEvent

serialPortBluetoothSerialPort

inputStreamSppInputStream

outputStreamSppOutputStream

connectDataConnectData

try

if(bytesRead != -1)

catch(BlipServerConnectionException e)

catch(IOException e)

try

catch(BlipServerConnectionException e)

catch(ProfileException e)

1.4.2: removeSession(connectData.getTerminalID()):void

1.4.1: getTerminalID():com.blipsystems.blipnet.api.bluetooth.Bluetoo...

1.1.5.2: write(buffer, 0, bytesRead):void

1.1.5.1: outputStream:=getOutputStream():com.blipsystems.blipnet...

1.1.4: bytesRead:=read(buffer):int

1.1.3: inputStream:=getInputStream():com.blipsystems.blipnet.api....

1.1.2: serialPort:=getSerialPort():com.blipsystems.blipnet.api.profil...

1.1.1: removeEventListener(this):void

1: handleSppClientEvent(SppClientEvent):void

Page 58: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

SPP Client Sample

Object1

initialOppClientSample

if(eventID == SessionEvent.SESSION_REMOVED || eventID == SessionEvent.SESSION_CREATE_FAILED)

try

catch(BlipServerConnectionException e)

evtSessionEvent

handleBlipNodeHandle

if(eventID == SessionEvent.SESSION_REMOVED || eventID == SessionEvent.SESSION_CREATE_FAILED)

try

catch(BlipServerConnectionException e)

1.2.2.1: removeSessionEventListener(this):void

1.2.1: cause:=getCause():int

1.1: eventID:=getEventID():int

1: handleSessionEvent(SessionEvent):void

Page 59: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

SPP Server Classes

interfaceSppServerHandler

+addEventListener:void+addEventListener:void+removeEventListener:void+registerSppServer:void+deregisterSppServer:void

TerminalEventinterface

SppServerEvent

+SERIAL_PORT_READY:int+SERVICE_REGISTERED:int+SERVICE_REGISTRATION_FAILED:int+SERVICE_DEREGISTERED:int+SERIAL_PORT_CLOSED:int

OutputStreamSerializable

SppOutputStream

InputStreamSerializable

SppInputStream

SerializableSppService

serviceName:String authenticationRequired:boolean

ProfileExceptionSppException

Serializableinterface

BluetoothSerialPort

+addEventListener:void+removeEventListener:void

inputStream:SppInputStream outputStream:SppOutputStream

interfaceSerialPortEventListener

+serialEvent:void

Serializableinterface

SerialPortEvent

+DATA_AVAILABLE:int+OUTPUT_BUFFER_EMPTY:int

interfaceSppServerEventListener

+handleSppServerEvent:void

Page 60: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

SPP Server Sample

• Register service on BlipNodeHandle• Listen for incoming connections, and say Hello

public class SppServerSample implements SppServerEventListener {

// Request serial port

public void start(BlipNodeHandle handle) {}

// Implement Event Listener

public void handleSppClientEvent(SppClientEvent evt) {}

}

Page 61: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

SPP Server Sample

handleBlipNodeHandle

handlerSppServerHandler

serviceSppService

initialSppServerSample

try

catch(BlipServerConnectionException e)

catch(SppException e)

Object1

try

catch(BlipServerConnectionException e)

catch(SppException e)

1: start(BlipNodeHandle):void

1.1.4: registerSppServer(service):void

1.1.3: <constructor>("Hello Server")

1.1.2: addEventListener(this):void

1.1.1: handler:=getSppServerHandler():com.blipsystems.blipnet.api...

Page 62: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

SPP Server Sample

Object1

initialSppServerSample

if(eventID == SppServerEvent.SERIAL_PORT_READY)

try

catch(BlipServerConnectionException e)

catch(IOException e)

evtSppServerEvent

serialPortBluetoothSerialPort

outputStreamSppOutputStream

inputStreamSppInputStream

if(eventID == SppServerEvent.SERIAL_PORT_READY)

try

catch(BlipServerConnectionException e)

catch(IOException e)

1.2.1.5: read(bytes):int

1.2.1.4: write("Hello".getBytes()):void

1.2.1.3: inputStream:=getInputStream():com.blipsystems.blipnet.ap...

1.2.1.2: outputStream:=getOutputStream():com.blipsystems.blipnet...

1.2.1.1: serialPort:=getSerialPort():com.blipsystems.blipnet.api.prof...

1.1: eventID:=getEventID():int

1: handleSppServerEvent(SppServerEvent):void

Page 63: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

Personal Area Network (PAN)

• Ethernet Cable Replacement Bridge Ethernet traffic over Bluetooth

• Supported by Bluetooth Enabled PDA’s and Computers

• NAP invoked PAN sessions BlipNode is PAN Server

• Detect IP Address of Connected Devices

Page 64: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

Personal Area Network (PAN)

ProfileHandlerinterface

PanNapHandler

ProfileExceptionPanException

Page 65: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

Positioning with BlipNet

BlipNet API featuresImplementation DetailsPositioning with BlipNetBuilding End2End Solutions

Page 66: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

Positioning methods

• ACL Based Using RSSI and BER on active ACL connections

• Inquiry Based Using RSSI from Inquiry Events

Page 67: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

RSSI and BER on ACL links

• RSSI Value between 20 and -10 (0 is best) Affected by Golden Receiver Range

Adaptive power control widens deadband

RSSI on ACL doesn’t say much about distance

• BER Value reported in percent by BlipNet

API A link with a BER between 0%

and 0.1% is workable A link with a BER above 1% will

give very poor results

-15

-10

-5

0

5

10

15

20

25

-90

-60

-40

-20 0

Incoming Signal Strength (dBm)

GRR

Page 68: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

RSSI and BER on ACL links (2)

• Measurement Frequency Configurable through LinkMeasurementSettings

blipNodeSettings.setLinkMeasurementSettings(...);

public interface LinkMeasurementSettings {

public void setEnabled(boolean enabled);

public void setMeasurementInterval(int interval);

public void setRssiZones(byte[] rssiZones);

public void setLinkQualityZones(double[] qualZones);

}

• Measurement Zones Measurement data only sent when RSSI or BER changes from one zone

to another

Page 69: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

RSSI and BER on ACL Links (3)

• Measurement Zones example RSSI Zones = {-10, -5, 0, 5} defines the following zones:

Zone1: RSSI <= -10 Zone2: -10 < RSSI <= -5 Zone3: -5 < RSSI <= 0 Zone4: 0 < RSSI <= 5 Zone5: RSSI > 5

Measurement Sequence RSSI = 0 -> Zone3 -> Status event sent (first measurement) RSSI = -2 -> Zone3 -> No Status event RSSI = -8 -> Zone2 -> Status Event sent RSSI = -9 -> Zone2 -> No Status event RSSI = -10 -> Zone1 -> Status Event sent

Page 70: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

RSSI on Inquiry

• RSSI Value between -20 and -90 Incoming Signal Strength (dBm)

• Better for range detection Not affected by Golden Receiver Range

Page 71: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

Link

• Master Thesis on Positioning using Bluetooth (BlipNet) http://kom.aau.dk/~jf/documents.htm

Page 72: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

Building End2End Solutions

BlipNet API featuresImplementation DetailsPositioning with BlipNetBuilding End2End Solutions

Page 73: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

Using BlipNet with MIDP

• Java API for Bluetooth (JSR-82) Supported by most new phones with Java and Bluetooth

• Enables stream-based communication over Bluetooth

• Supported Profiles OBEX SPP

SPP/OBEXApplication

JSR-82enableddevice

BlipNet

Page 74: BlipNet API Jan Justesen Software Designer [jan.justesen@blipsystems.com]

Questions?