The toolkit allows you to develop and test applications that use Bluetooth technology even if you don't have any actual Bluetooth hardware. The toolkit simulates a Bluetooth environment, in which you can run multiple emulator instances that can discover each other and exchange data using the Bluetooth API.
An example application, BluetoothDemo, shows how to transfer imagesfrom one emulator to another.
The J2ME Wireless Toolkit implements OBEX transfer over simulated Bluetooth and infrared connections. The simulated infrared connection
follows the IrDA standard defined by the Infrared Data Association. The toolkit simulates infrared transfers between multiple running emulators.
You can configure the Bluetooth and OBEX environment using the Bluetooth/OBEX tab in the toolkit preferences. This controls such
parameters as how long the emulator attempts to discover other devices in the simulated Bluetooth environment and the maximum packet size. See the toolkit's User's Guide for more details.
Local Files and Personal Information
The J2ME Wireless Toolkit supports JSR 75, the PDA Optional Packages for the J2ME Platform, which also includes two independent APIs:
The FileConnection API gives MIDlets access to a local file system on the device.
The Personal Information Management (PIM) optional package includes APIs for manipulating contact lists, calendars, and to-do lists.
A real device may have a local file system which can be accessed using the FileConnection API. In the J2ME Wireless Toolkit emulator, a simulated file system is maintained as a directory on your hard disk.
The files your application can access using FileConnection are stored in subdirectories of <toolkit>\appdb\<skin>\filesystem., where <toolkit> is the installation directory of the J2ME Wireless Toolkit and <skin> is the name of the emulator skin. For example, the DefaultColorPhone emulator skin comes with a root directory installed called root1, which contains a file called Readme. The file's full path is <toolkit>\appdb\DefaultColorPhone\filesystem\root1\Readme.
You can manage the root directories that are available by choosing MIDlet > External events from the emulator window's menu. You'll see a small utility window for adding and removing roots. These actions will also generate events for a registered listener object.
In a real device, personal information might be stored in a proprietary
format in memory. The emulator uses a directory on your hard disk to
contain this information, accessible using the PIM API. All information is stored in <toolkit>\appdb\pim. Lists are stored in subdirectories of the contacts, events, and todo directories. For example, a contact list called Contacts is contained in <toolkit>\ appdb\ pim\ contacts\ Contacts.
Inside the list directory, items are stored in standard formats specified by the Internet Mail Consortium. Contacts are stored in vCard format, while calendar and to-do items are both stored in vCalendar format.
Summary
The J2ME Wireless Toolkit 2.2 is much more than an incremental update of an excellent tool. It includes support for four exciting new
specifications that together define six new APIs. As the world of wireless Java technology rapidly evolves, the J2ME Wireless Toolkit keeps pace and contains all the tools you need for
About the Author: Jonathan Knudsen [e-mail] [home page] is the author of several books, including Wireless Java (second edition), The Unofficial Guide to LEGO MINDSTORMS Robots, Learning Java (second edition), and Java 2D Graphics. Jonathan has written extensively about Java and Lego robots, including articles for JavaWorld, EXE, NZZ Folio, and the O'Reilly Network. Jonathan holds a degree in mechanical engineering from Princeton University.
<< 上一页 [11] [12] [13] [14] [15] [16] [17] 下一页