Was anybody in this forum able to do a successful, general java bluetooth service discovery on a 6600?
Device discovery works fine for me, but I am not able to discover any service with my midlets.
I guess, my main problem is, that I try to discover available services in general. My midlet searches for any service I was able to find a UUID for; but although there are several devices with various services (a second mobile phone, a pc-bluetooth card, a gps-receiver, etc.) found by my 6600, there seems to be never any service ¡_
Maybe anybody has a little advice for me concerning the service UUIDs to provide for service discovery!
My discovery-code looks like this:
local.setDiscoverable(DiscoveryAgent.GIAC)
int attrbs[]={ 0x0100 }; // null should deliver default attributes ¡_
UUID[] uuidSet= new UUID[75];
// a list of UUIDs I found on the web:
uuidSet[0]=new UUID( 0x0000);
uuidSet[1]=new UUID( 0x0001);
uuidSet[2]=new UUID( 0x0002);
uuidSet[3]=new UUID( 0x0003);
uuidSet[4]=new UUID( 0x0004);
uuidSet[5]=new UUID( 0x0005);
uidSet[6]=new UUID( 0x0006);
uuidSet[7]=new UUID( 0x0007);
uuidSet[8]=new UUID( 0x0008);
uuidSet[9]=new UUID( 0x0009);
uuidSet[10]=new UUID( 0x000A);
uuidSet[11]=new UUID( 0x000B);
uuidSet[12]=new UUID( 0x000C);
uuidSet[13]=new UUID( 0x000D);
uuidSet[14]=new UUID( 0x0200);
uuidSet[15]=new UUID( 0x0201);
uuidSet[16]=new UUID( 0x0300);
uuidSet[17]=new UUID( 0x0301);
uuidSet[18]=new UUID( 0x0302);
uuidSet[19]=new UUID( 0x0303);
¡_ list of further UUIDs ¡_
uuidSet[75]=new UUID( 0x1126);
RemoteDevice d=(RemoteDevice)devices.nextElement(); // a single discovered device.
disc_agent.searchServices( attrbs, uuidSet, d, serv_listener ); //serv_listener implements the Discovery_Listener Interface ¡_
After waiting for the discovery to finish, there is never a service available.
Every example I was able to find until now only employs the discovery of a ¡°proprietary¡± set service, a kind of client-server hello world.
I appreciate every suggestion on what I am doing wrong!!!
Thanx
jdevmo
Re: java bluetooth service discovery with 6600
2006-02-01, 06:37#2
hi every one iam also having the same problem my client is not able to find the services provided by my server.iam using my pc as server which uses avelink bluetooth stack and my client is running on 6600.i did every thing what benhui
web site has given.but still it doesnot work
any idea about this.
Re: java bluetooth service discovery with 6600
2006-04-22, 16:11#5
hi every body! i have the same problem as vicky. I am using a bluetooth USB dongle and avelink (Atinav) bluetooth protocol stack. the problem lies in the service discovery. after service search is over i get SERVICE_SEARCH_ERROR. i can not figure out what is the problem.
After divice discovery is over i used this code
------------------------------
public void inquiryCompleted(int i) {
if(ndevice==0)
{
remoteString.setText(remoteString.getText()+"No remote device found!\n");
----------------------------
when search is over i get service search error
public void serviceSearchCompleted(int i, int respCode)
{
if(nservice==0)
{
remoteString.setText(remoteString.getText()+"No service found on remote device!\n");
}
else
{
remoteString.setText(remoteString.getText()+Integer.toString(nservice)+" service(s) found on remote device!\n");
}
String message="";
if (respCode == DiscoveryListener.SERVICE_SEARCH_DEVICE_NOT_REACHABLE)
{
message = "Device not reachable";
}
else if(respCode == DiscoveryListener.SERVICE_SEARCH_NO_RECORDS)
{
message = "Service not available";
}
else if (respCode == DiscoveryListener.SERVICE_SEARCH_COMPLETED)
{
message = "Service search completed";
}
//send data
if(respCode == DiscoveryListener.SERVICE_SEARCH_COMPLETED)
{
try
{
remoteString.setText(remoteString.getText()+"Sending Data with discovered services.");
int j=0;
ServiceRecord record;
while(serviceRecord.elementAt(j)==null&&j<serviceRecord.size())
{
j++;
}
record=(ServiceRecord)serviceRecord.elementAt(j);
String url=record.getConnectionURL(ServiceRecord.NOAUTHENTICATE_NOENCRYPT,false);
StreamConnection conn=(StreamConnection)Connector.open(url);
DataOutputStream out=conn.openDataOutputStream();
out.writeChars("This is the data sent by cleint. ID=718bt1128");
out.flush();
remoteString.setText(remoteString.getText()+"Data sent to server. ID=718bt1128");
out.close();
conn.close();
conn=null;