Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Technology Initiative
AITI 2009
Bluetooth
• enables communications for devices
physically located close to one another
• radio connectivity technology designed to
create Personal Area Networks ( PAN )
– printing a file to a printer nearby
– finding out more info on a dream home for
sale
– seeing if the girl across the room is single and
available for dinner
2
Africa Information Technology Initiative © 2009 http://aiti.mit.edu
Network
• one master device and seven slave
devices
• master device can also act as slave device
-> creates a bridge to expand network
3
Africa Information Technology Initiative © 2009 http://aiti.mit.edu
Bluetooth protocol stack
4
Africa Information Technology Initiative © 2009 http://aiti.mit.edu
Bluetooth implementation
• contains both hardware and software
components
• software enables data to be interchanged
between locally connected devices
• Different interactions
– Discovery: find other devices, possible usefulness
– Client Activities: printing to nearby printer
– Server Activities: provide services/information
– Peer Activities: exchanging info back and fourth
5
Africa Information Technology Initiative © 2009 http://aiti.mit.edu
Bluetooth API
• Accessing Local Bluetooth Stack
LocalDevice class -> get info from stack
6
Africa Information Technology Initiative © 2009 http://aiti.mit.edu
more methods
DiscoveryAgent getDiscoveryAgent();
- used to obtain instance of device's DiscoveryAgent
String getFriendlyName();
- returns name of your device
7
Africa Information Technology Initiative © 2009 http://aiti.mit.edu
Making LocalDevice instance
• static LocalDevice getLocalDevice();
– called a Bluetooth Manager
8
Africa Information Technology Initiative © 2009 http://aiti.mit.edu
Discovering Devices
• DiscoveryAgent
– helps discover devices/services in PAN
– request status of agent
– tell agent to call you back when it discovers
DiscoveryAgent myDa =
LocalDevice.getInstance().getDiscoveryA
gent();
9
Africa Information Technology Initiative © 2009 http://aiti.mit.edu
Discovery methods
• To start discovering:
boolean startInquiry(int accessCode,
DiscoveryListener listener);
– access codes determines type of access
• usually DiscoveryAgent.GIAC
– each device that is discovered, registered listener will
receive notification
10
Africa Information Technology Initiative © 2009 http://aiti.mit.edu
DiscoveryListener interface
• void deviceDiscovered(RemoteDevice btDevice,
DeviceClass cod);
– method is called when device is discovered
• void inquiryCompleted(int discType);
– method is called when inquiry process is completed
– discType possibilities:
• DiscoveryListener.INQUIRY_COMPLETED
• DiscoveryListener.INQUIRY_TERMINATED
• DiscoveryListener.INQUIRY_ERROR
11
Africa Information Technology Initiative © 2009 http://aiti.mit.edu
Discovering Services
• with RemoteDevice,you can search through services
http://java.sun.com/javame/reference/apis/
jsr082/
Bluetooth API
13
Africa Information Technology Initiative © 2009 http://aiti.mit.edu