I'm developing a j2me application for my mobile phone (a Nokia). I'm using WTK (Wireless Toolkit) to test my code. Because I'm using a GPS device via a Bluetooth connection, I would like to be able to extend the emulator with bluetooth possibilities. Has anyone e开发者_Go百科xperience with BT & WTK?
according to this article there is no way to do it by default. Any other ideas?
The emulators "emulate" bluetooth, by allowing you to make a connection between running emulators using the bluetooth API.
I've never tried to convince an emulator to use actual bluetooth on a PC (however I suspect it may be just possible on the Sony Ericsson emulator using some hacking of where the Bluetooth API points to, would be a lot of work though).
Easier approach: if you're emulating a bluetooth GPS, write a MIDlet which acts as a Bluetooth serial server, and preload it with a bunch of NMEA data from your GPS unit. Get the MIDlet spitting that out continuously on a loop.
Run that MIDlet, then get your real app to connect to that MIDlet (using emulated bluetooth) and consume the NMEA data as if it were coming from a real GPS -- bingo!
HTH
精彩评论