You Are Here:

Community: Developer Discussion Boards

#1 Old Lightbulb Bluetooth device service discovery and "Pairing" - 2008-02-17, 00:39

Join Date: Feb 2008
Posts: 3
blundell
Offline
Registered User
Hey first time post, I was looking for some help.

I've written myself a MIDP application and I want it to be able to connect to the same app on other devices using bluetooth.
I would like my devices to "PAIR" (pairing should allow connection without user acceptance from the 2nd time onwards?)

I then want it to exchange about four strings so pretty easy communication you'd think.


I can show a list of available devices in my midp with the following code

Firstly it finds the devices and counts them up
Code:
public void deviceDiscovered(RemoteDevice remoteDevice, DeviceClass deviceClass) //find devices add them to a vector
{
    	devices.addElement(remoteDevice);
	Form form = new Form( "Searching" );
	form.append( "Found " + Integer.toString(devices.size()).toString() + " devices" );
	Display.getDisplay(this).setCurrent( form );            
}
It then shows the name of each device within a list

Code:
public void inquiryCompleted(int discoveryType) //Print devices found
{
    devices.trimToSize();	
	/* create a list widget */
	List chooseList = new List( Integer.toString(devices.size()).toString() + " devices", List.IMPLICIT );
	
	try 
        {
	    int i;	 
for(i = 0; i < devices.size(); i++) {
		RemoteDevice d = (RemoteDevice)devices.elementAt(i);
		chooseList.set(i, d.getFriendlyName(false), null);
	    }
	    
            mBackCommand = new Command("Back", Command.BACK, 0);
	    chooseList.addCommand(mBackCommand);
            chooseList.setCommandListener(new CommandListener()
			{public void commandAction(Command mBackCommand, Displayable s){display.setCurrent(mList);
        }}); 
            
	} 
        catch (Exception e) 
        {
	    System.out.println(e);
	}    
    
}
Obviously I now have to find what services these devices offer. However how do i no what service I want? All i want to do is click on a device and pair it with the current one. Is this a service? or do i need to find another service to get to this?

Any and all help is much appreciated

Paul

p.s. sorry if i've conveyed myself poorly, found it a bit tricky to explain, any querys i'll try to answer to inform you more
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia