I'm trying to read contacts using 32feet library for c#. I'm connecting my PC to mobile device via bluetooth, and when I try to execute this code always give me bad request error
LocalInfo.SetServiceState(BluetoothService.PhonebookAccessPce, true);
BluetoothAddress addr = BluetoothAddress.Parse("00:00:00:00:00:00");
BluetoothEndPoint rep = new BluetoothEndPoint(addr, BluetoothService.PhonebookAccessPse);
BluetoothClient cli = new BluetoothClient();
cli.Connect(rep);
Uri uri = new Uri(ObexUri.UriSchemeObex + "://" + addr + "/telecom/pb.vcf");
ObexWebRequest request = new ObexWebRequest(uri);
request.Method = "GET";
request.ContentType = "text/x-vCard";
ObexWebResponse resp = (ObexWebResponse)request.GetResponse();
And in the constructor:
private BluetoothDeviceInfo localinfo = null;
public BluetoothDeviceInfo LocalInfo
{
get
{
return localinfo = (localinfo ?? new BluetoothDeviceInfo(BluetoothRadio.PrimaryRadio.LocalAddress));
}
}
What I'm doing wrong? Is the URI wrong, or I need a different Bluetooth?
Though I am not an expert in 32feet, I know that the
Name Headerof theGETrequest retrieving vcard should benull. Why don't you try using empty ornullURI?Edit I found some statements that requires you to use obex-ftp instead of obex.
And it is cited from here.
Edit
--according to wikipedia you should put some specific UUID to
TARGETheader when you connect tophonebook access.Like codes from here, you should not only specify PBAP Service UUID
0000112f-0000-1000-8000-00805f9b34fbon RFCOMM level, but also have to specify target header UUID0x79, 0x61, 0x35, (byte) 0xf0, (byte) 0xf0, (byte) 0xc5, 0x11, (byte) 0xd8, 0x09, 0x66, 0x08, 0x00, 0x20, 0x0c, (byte) 0x9a, 0x66on OBEX level in type header.