You Are Here:

Community: Developer Discussion Boards

#1 Old Unhappy bluetooth attribute problem....help - 2006-05-09, 22:21

Join Date: May 2006
Posts: 2
pascione
Offline
Registered User
Hi all,

I have a problem with attribute in bluetooth, here is my code:

try {
device = LocalDevice.getLocalDevice();
device.setDiscoverable(DiscoveryAgent.GIAC);

String url2 = "btspp://localhost:"
+ uuid2.toString()
+";authorize=true;authenticate=false;encrypt=false"
+ ";name="
+ appName;

server = (StreamConnectionNotifier) Connector.open(url2);


ServiceRecord rec = device.getRecord(server);

DataElement elm = null;
elm = new DataElement(DataElement.STRING,"BT Server");
if(rec.setAttributeValue(0x101,elm))
log("101 added");

/* Set service provider name */
elm = new DataElement(
DataElement.STRING,"CINI, Research Group");
if(rec.setAttributeValue(0x102,elm))
log("102 added");
// rec.setDeviceServiceClasses(SERVICE_TELEPHONY);
device.updateRecord(rec);
c = server.acceptAndOpen();
}
Server should add these attributes: 258,257,256,4,1

Client:

DataElement dataelem = null;
String name = null;
for ( int i=0; i< records.length; i ++ )
{

ServiceRecord record = records[i];
int IDs2[] = record.getAttributeIDs();
for (int j=0;j<IDs2.length;j++){
DataElement prova = record.getAttributeValue(IDs2[j]);
System.out.println(IDs2[j]+" "+prova.getDataType());
if(prova.getDataType()==DataElement.STRING)
System.out.println(prova.getValue().toString());
}
services.addElement( record );
}
}

Client retrieves only these attribute: 0,1,4

where is the problem?
My code has been copied from other working code.
I use nokia 9500 but also nokia 6680 and it does not work the same.

please help me :-(

Paolo
Reply With Quote

#2 Old Re: bluetooth attribute problem....help - 2006-05-09, 23:35

Join Date: May 2006
Posts: 2
pascione
Offline
Registered User
Ok I have the solution.

Thanks everybody
Reply With Quote

#3 Old Re: bluetooth attribute problem....help - 2006-05-17, 19:01

Join Date: May 2006
Posts: 6
edazcnokia
Offline
Registered User
Hello.
Could you please talk about the solution? I have the same problem, but only when I build with NetBeans 5.0 (building with WTK attributes are correctly published).
Thanks.
Reply With Quote

#4 Old Re: bluetooth attribute problem....help - 2006-05-21, 12:19

Join Date: Dec 2005
Posts: 1,159
Location: England,UK
jimgilmour1's Avatar
jimgilmour1
Offline
Forum Nokia Champion
If you are using BluecoveXP the Service Record will not support extra attributes.

Only UUID = {0x0000,0x0001,0x0004,0x0100);
You can recompile BlueCove to add attributes,which works,but obviously its unique, and not dynamic and non standard.


The Mobility toolkit will support more but obviously this does not connect with the real world! as its an emulator.

I have not use NB 5.1 and Netbeans 5.1 mobility, but NB 5.0 beta did NOT work, so updgrading to 5.1 and Netbeans 5.1 Mobility might be the answer. It works in Nb 4.1

Jim
Last edited by jimgilmour1 : 2006-05-21 at 12:29.
Reply With Quote

#5 Old Re: bluetooth attribute problem....help - 2006-09-25, 18:45

Join Date: May 2006
Posts: 6
edazcnokia
Offline
Registered User
Thanx Jim.
My problem with custom service attributes in midlets was that I was not fetching them at service discovery. I solved it simply adding my custom attribute numbers in the array passed to DiscoveryAgent.searchServices function as first parameter. It was not a problem of NetBeans :$

About Bluecove, I could see that UpdateRecord function is not available with this library, so it does not allow for custom service attributes. I'll try to achieve this using Avetana with Bluez in a Linux Server instead.

Edazc
Reply With Quote

#6 Old Re: bluetooth attribute problem....help - 2006-09-26, 15:34

Join Date: Dec 2005
Posts: 1,159
Location: England,UK
jimgilmour1's Avatar
jimgilmour1
Offline
Forum Nokia Champion
Quote:
Originally Posted by edazcnokia
Thanx Jim.
My problem with custom service attributes in midlets was that I was not fetching them at service discovery. I solved it simply adding my custom attribute numbers in the array passed to DiscoveryAgent.searchServices function as first parameter. It was not a problem of NetBeans :$

About Bluecove, I could see that UpdateRecord function is not available with this library, so it does not allow for custom service attributes. I'll try to achieve this using Avetana with Bluez in a Linux Server instead.

Edazc
Glad you has success.

Quote:
About Bluecove, I could see that UpdateRecord function is not available with this library, so it does not allow for custom service attributes
Yes this is true. I dont have a problem as Avetana cannot currently update services either, you may have more luck on Bluez because you do not have to work with XP internals for bluetooth.
Jim
Reply With Quote

#7 Old Re: bluetooth attribute problem....help - 2007-03-14, 13:47

Join Date: Aug 2006
Posts: 47
Location: Cairo, Egypt
Send a message via MSN to samooha_2020 Send a message via Skype™ to samooha_2020
samooha_2020
Offline
Registered User
hi all,
i'm making HID service Record & having a problem in setDeviceServiceClasses(int ) function

it throw an exception {java.lang.IllegalArgumentException attempt to set incorrect bits}' when it takes 0x1124 as parameter
& i don't know wht to do...
so plz if anyone knows the solution plz tell me
thnx alot
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
Similar Threads
Thread Thread Starter Forum Replies Last Post
Nokia SDK Bluetooth service re-discovery problem, Help Me!:( tomsonxu Mobile Java Networking & Messaging & Security 0 2005-11-08 08:44
Nokia SDK Bluetooth service re-discovery problem, Help Me!:( tomsonxu Mobile Java Tools & SDKs 0 2005-11-08 08:39
Bluetooth Problem israel.martinez Mobile Java Networking & Messaging & Security 0 2005-10-28 19:39
Problem with the Nokia 6600, Bluetooth and Monty Thread tenfourty Mobile Java General 15 2005-09-30 15:15
Bluetooth problem in Symbian C++ code vardhman Bluetooth Technology 0 2005-01-02 09:17

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