ubiMobileClient
Fri Jan 27 19:11:38 KST 2006
Root Package
Class Diagrams
diagram <default>
Subpackages
package images
package net
package ubiMobile
Class Diagrams
Class Diagram <default>
package: <default>
Package Nodes
images
net
ubiMobile
Package Node Detail
Package images
Package ubiMobile
Package net
Package images
Class Diagrams
diagram images
Class Diagrams
Class Diagram images
package: images
Package net
Class Diagrams
diagram net
Subpackages
package net.benhui
Class Diagrams
Class Diagram net
package: net
Package Nodes
benhui
Package Node Detail
Package net.benhui
Package net.benhui
Class Diagrams
diagram benhui
Subpackages
package net.benhui.btgallery
Class Diagrams
Class Diagram benhui
package: net.benhui
Package Nodes
btgallery
Package Node Detail
Package net.benhui.btgallery
Package net.benhui.btgallery
Class Diagrams
diagram btgallery
Subpackages
package net.benhui.btgallery.bluelet
package net.benhui.btgallery.spp_bt
Classes
class MessageUI
class Util
Class Diagrams
Class Diagram btgallery
package: net.benhui.btgallery
Package Nodes
bluelet
spp_bt
Class Nodes
MessageUI
Util
Package Node Detail
Package net.benhui.btgallery.spp_bt
Package net.benhui.btgallery.bluelet
Class Detail
Class MessageUI
package: net.benhui.btgallery
net.benhui.btgallery.MessageUI
public class MessageUI
Extends:
Canvas
A screen to display text string on screen.

Description: This is a canvas screen to display the current messages in
virtual chat room. Only the latest messages are displayed. If there are more
messages than those can fit into one screen, old messages are roll off from
the upper edge. User is not able to scroll back to see old messages, however,
the old messages is still available in msgs Vector until a clear command
is invoked. When a clear command is invoked, all message will be removed
from msgs vector.


Copyright: Copyright (c) 2003

Author:
Ben Hui (www.benhui.net)
Version:
1.0
Field Summary
public int
public int
Font
int
int
int
public Vector
int
int
int
Constructor Summary
public
Method Summary
public void
add(String s)
public void
addNoRepaint(String s)
public void
public void
keyPressed(int key)
protected void
paint(Graphics g)
Field Detail
backTo
public int backTo = 0

bookmarkId
public int bookmarkId = 1

f
Font f

fh
int fh

h
int h

midx
int midx = 0

msgs
public Vector msgs = new Vector()

w
int w

x0
int x0 = 0

y0
int y0 = 0
Constructor Detail
MessageUI
public MessageUI()
Method Detail
add
public void add(String s)

addNoRepaint
public void addNoRepaint(String s)

clear
public void clear()

keyPressed
public void keyPressed(int key)

paint
protected void paint(Graphics g)
Class Util
package: net.benhui.btgallery
public class Util

Title: A utility class to dump JABWT object contents and perform object conversion


Description: A collection of print utility method that output the attributes of JABWT objects to System.out
Supported objects are:

LocalDevice

RemoteDevice

DeviceClass

UUID

ServiceRecord

DataElement

Major Service Class

Major, Minor Device ClassAttribute ID

OBEXHeader (incomplete)


Copyright: Copyright (c) 2003

Author:
Ben Hui (www.benhui.net)
Version:
1.0

LICENSE:
This code is licensed under GPL. (See http://www.gnu.org/copyleft/gpl.html)
Constructor Summary
private
Method Summary
public static String
attrTypeToName(int type)
public static String
idToName(int id)
public static String
public static String
public static String
minorToName(int d, int m)
public static void
printDataElement(DataElement e, int id, String indent)
public static void
printLocalDevice(LocalDevice dev)
public static void
printObexHeaderSet(HeaderSet h)
public static void
printRemoteDevice(RemoteDevice dev, DeviceClass devClass)
public static void
printServiceRecord(ServiceRecord r)
public static String
toHexString(byte[] b)
public static String
public static String
toHexString(long l)
public static String
uuidToName(UUID u)
Constructor Detail
Util
private Util()
Method Detail
attrTypeToName
public static String attrTypeToName(int type)

idToName
public static String idToName(int id)

majorServiceToName
public static String majorServiceToName(int d)

majorToName
public static String majorToName(int d)

minorToName
public static String minorToName(int d, int m)
Parameters:
d major device class
m minor device class
Returns

printDataElement
public static void printDataElement(DataElement e, int id, String indent)

printLocalDevice
public static void printLocalDevice(LocalDevice dev)

printObexHeaderSet
public static void printObexHeaderSet(HeaderSet h)

printRemoteDevice
public static void printRemoteDevice(RemoteDevice dev, DeviceClass devClass)

printServiceRecord
public static void printServiceRecord(ServiceRecord r)

toHexString
public static String toHexString(long l)

toHexString
public static String toHexString(byte[] b)

toHexString
public static String toHexString(int i)

uuidToName
public static String uuidToName(UUID u)
Package net.benhui.btgallery.bluelet
Class Diagrams
diagram bluelet
Classes
class BLUElet
class RemoteDeviceUI
Class Diagrams
Class Diagram bluelet
package: net.benhui.btgallery.bluelet
Class Nodes
BLUElet
RemoteDeviceUI
Class Detail
Class BLUElet
package: net.benhui.btgallery.bluelet
public class BLUElet
Implements:
CommandListener

Title: Bluetooth Application Utility GUI Component


Description:

Note: This class must be used as singleton.

Author:
Ben Hui (www.benhui.net) - refered by Yoosoo Oh (2005.11.13)
Version:
1.0

LICENSE:
This code is licensed under GPL. (See http://www.gnu.org/copyleft/gpl.html)
Inner Class Summary
final static class
BLUElet.Listener
   Bluetooth listener object.
 
final static class
BLUElet.Worker
   Worker thread that invoke callback CommandListener upon Bluetooth event occurs.
 
Field Summary
private DiscoveryAgent
public static Command
public static CommandListener
public static Command
private LocalDevice
public static Vector
public int
public static Vector
public int
public static Display
public static MIDlet
private final static int
private final static int
private final static int
public static BLUElet
public boolean
public static Command
public static int
public int
public static Vector
public UUID[]
int
cmd
Constructor Summary
public
BLUElet(MIDlet host, CommandListener listener)
   Creae a new BLUElet.
 
public
Worker(int cmd)
Method Summary
public void
commandAction(Command c, Displayable d)
public void
destroyApp(boolean unconditional)
   Mirror MIDlet.destroyApp(), should be called by your MIDlet destroyApp().
 
public int
   Return the Bluetooth result code from device inquiry.
 
public ServiceRecord[]
   Get all discovered services from selected remote device.
 
public ServiceRecord
   Get the first discovered service from selected remote device.
 
public RemoteDevice
   Return user selected remote device that is used for service discovery.
 
public int
   Return the Bluetooth result code from service discovery.
 
public Screen
   Obtain reference to device selection screen component.
 
public void
deviceDiscovered(RemoteDevice remoteDevice, DeviceClass deviceClass)
public void
inquiryCompleted(int complete)
public void
servicesDiscovered(int transId, ServiceRecord[] records)
public void
serviceSearchCompleted(int transId, int complete)
public static void
log(String s)
   Utility function to write log message.
 
public void
   Mirror MIDlet.pauseApp(), should be called by your MIDlet pauseApp().
 
public void
public void
   Mirror MIDlet.startApp(), should be called by your MIDlet startApp().
 
public void
startInquiry(int mode, UUID[] serviceUUIDs)
   Start device inquiry.
 
public void
run()
Field Detail
agent
private DiscoveryAgent agent

BACK
public static Command BACK = new Command( "Back", Command.BACK, 1 )

callback
public static CommandListener callback

COMPLETED
public static Command COMPLETED = new Command( "COMPLETED", Command.SCREEN, 1 )

device
private LocalDevice device

deviceClasses
public static Vector deviceClasses = new Vector()

deviceReturnCode
public int deviceReturnCode

devices
public static Vector devices = new Vector()

discoveryMode
public int discoveryMode

display
public static Display display

host
public static MIDlet host

ID_DEVICE_COMPLETED
private final static int ID_DEVICE_COMPLETED = 2

ID_DEVICE_SELECTED
private final static int ID_DEVICE_SELECTED = 3

ID_SERVICE_COMPLETED
private final static int ID_SERVICE_COMPLETED = 1

instance
public static BLUElet instance

remotedeviceui
private RemoteDeviceUI remotedeviceui = null

search_loop_flag
public boolean search_loop_flag = true

SELECTED
public static Command SELECTED = new Command( "SELECTED", Command.SCREEN, 1 )

selectedDevice
public static int selectedDevice = -1

serviceReturnCode
public int serviceReturnCode

services
public static Vector services = new Vector()

serviceUUIDs
public UUID[] serviceUUIDs = null
Constructor Detail
BLUElet
public BLUElet(MIDlet host, CommandListener listener)
Creae a new BLUElet.
Parameters:
host MIDlet
listener CommandListener
Method Detail
commandAction
public void commandAction(Command c, Displayable d)
Parameters:
c Command
d Displayable

destroyApp
public void destroyApp(boolean unconditional)
Mirror MIDlet.destroyApp(), should be called by your MIDlet destroyApp().

getDeviceDiscoveryReturnCode
public int getDeviceDiscoveryReturnCode()
Return the Bluetooth result code from device inquiry.
This is the result code obtained in DiscoveryListener.inquiryCompleted().
Your application cal call this method after a COMPLETED callback event
is received.
Returns:
int

getDiscoveredServices
public ServiceRecord[] getDiscoveredServices()
Get all discovered services from selected remote device.
Your application call this method after your app receive COMPLETED callback
event. This will return all services that match your UUIDs in startInquiry().
Returns:
ServiceRecord[]

getFirstDiscoveredService
public ServiceRecord getFirstDiscoveredService()
Get the first discovered service from selected remote device.
Your application call this method after your app receives COMPLETED
callback event. This will return the first service that match your
UUIDs in startInquiry().
Returns:
ServiceRecord null if no service discovered

getSelectedDevice
public RemoteDevice getSelectedDevice()
Return user selected remote device that is used for service discovery.
Your application can call this after your app received SELECTED callback
event.
Returns:
RemoteDevice null if user didn't select anything

getServiceDiscoveryReturnCode
public int getServiceDiscoveryReturnCode()
Return the Bluetooth result code from service discovery.
This is the result code obtained in DiscoveryListener.serviceSearchCompleted().
Your application cal call this method after a COMPLETED callback event
is received.
Returns:
int

getUI
public Screen getUI()
Obtain reference to device selection screen component.
You should show this screen when user invoke device search.
Returns:
Screen

log
public static void log(String s)
Utility function to write log message.
Parameters:
s String

pauseApp
public void pauseApp()
Mirror MIDlet.pauseApp(), should be called by your MIDlet pauseApp().

searchAction
public void searchAction()

startApp
public void startApp()
Mirror MIDlet.startApp(), should be called by your MIDlet startApp().

startInquiry
public void startInquiry(int mode, UUID[] serviceUUIDs)
Start device inquiry. Your application call this method to start inquiry.
Parameters:
mode int one of DiscoveryAgent.GIAC or DiscoveryAgent.LIAC
serviceUUIDs UUID[]
Class RemoteDeviceUI
package: net.benhui.btgallery.bluelet
net.benhui.btgallery.bluelet.RemoteDeviceUI
class RemoteDeviceUI
Extends:
List

Title: Remote Device List Component


Description: This is a List screen to display a list of discovered Bluetooth
devices. This is a class used by BLUEletUI.

Author:
Ben Hui (www.benhui.net)
Version:
1.0

LICENSE:
This code is licensed under GPL. (See http://www.gnu.org/copyleft/gpl.html)
Constructor Summary
public
Method Summary
public void
setMsg(String str)
   Set a one-line message to screen.
 
public void
   refresh the list with blutooth devices
 
Constructor Detail
RemoteDeviceUI
public RemoteDeviceUI()
Method Detail
setMsg
public void setMsg(String str)
Set a one-line message to screen.
Parameters:
str String

showui
public void showui()
refresh the list with blutooth devices
Package net.benhui.btgallery.spp_bt
Class Diagrams
diagram spp_bt
Classes
class SPP_Client
class SPP_Server
Class Diagrams
Class Diagram spp_bt
package: net.benhui.btgallery.spp_bt
Class Nodes
SPP_Client
SPP_Server
Class Detail
Class SPP_Client
package: net.benhui.btgallery.spp_bt
public class SPP_Client

Title: Example Serial Port Profile Client


Description: Important area: send_SPP_message()
This client only does the portion that send and receive data over a SPP
connection. In an actual client applicaion, you also need to do device
discovery and service discovery. This is taken care by Bluelet.
Author:
Ben Hui (www.benhui.net) - refered by Yoosoo Oh (2005.11.13)
Version:
1.0

LICENSE:
This code is licensed under GPL. (See http://www.gnu.org/copyleft/gpl.html)
Constructor Summary
public
Method Summary
public void
log(String s)
public void
send_SPP_message(ServiceRecord r, String msg)
   Send a message to server using Serial Port Profile.
 
Constructor Detail
SPP_Client
public SPP_Client()
Method Detail
log
public void log(String s)

send_SPP_message
public void send_SPP_message(ServiceRecord r, String msg)
Send a message to server using Serial Port Profile.
Connect to incoming service record, send a text, and read
in a text. This method illustrate how to send and receive
data using serial port profile.
Device and service discovery is part of Serial Port client but it is
done by Bluelet component. See SPP_MIDlet for usage of Bluelet.
Parameters:
msg
Class SPP_Server
package: net.benhui.btgallery.spp_bt
public class SPP_Server
Implements:
java.lang.Runnable

Title: Example Serial Port Profile Server.


Description: This example server only handle one SPP server connection
and wait for a client to connect. Once a client connection accept, it read
one string off the connection stream, display this string on screen, then
echo the string back to client.
Then it waits for the next client connection again.


Description: Important area: run()

Author:
Ben Hui (www.benhui.net) - refered by Yoosoo Oh (2005.11.13)
Version:
1.0

LICENSE:
This code is licensed under GPL. (See http://www.gnu.org/copyleft/gpl.html)
Field Summary
DiscoveryAgent
LocalDevice
public boolean
public StreamConnectionNotifier
private final static int
public final static UUID
Constructor Summary
public
Method Summary
public void
log(String s)
   An utility function to display a log message
 
public void
run()
public void
Field Detail
agent
DiscoveryAgent agent

device
LocalDevice device

done
public boolean done = false

server
public StreamConnectionNotifier server

SERVICE_TELEPHONY
private final static int SERVICE_TELEPHONY = 0x400000

uuid
public final static UUID uuid = new UUID("102030405060708090A0B0C0D0E0F010", false)
Constructor Detail
SPP_Server
public SPP_Server()
Method Detail
log
public void log(String s)
An utility function to display a log message
Parameters:
s String

run
public void run()

run_server
public void run_server()
Package ubiMobile
Class Diagrams
diagram ubiMobile
Classes
class RecStoreDB
class ubiMobile
Class Diagrams
Class Diagram ubiMobile
package: ubiMobile
Class Nodes
RecStoreDB
ubiMobile
Class Detail
Class RecStoreDB
package: ubiMobile
public class RecStoreDB
This class is ready to save the user's profile information in Record Store.

Since:
J2SDK1.5
Version:
ubi-UCAM 2.0 (ubiSensor)
Author:
Yoosoo Oh
Field Summa