Click here to Skip to main content
15,845,036 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how i can auto searching devices and sending file with bluetooth using 32feet ,C#,WPf.
please take example for me.

i searching the devices with this cod ,for example showing first device name in 1 label :
BluetoothDeviceInfo[] availableDevices;
var client = new BluetoothClient();
availableDevices = client.DiscoverDevices(); // I've found this to be SLOW!
int n = availableDevices.Length;
   lbl1.Content = availableDevices[0].DeviceName;</pre>

and this cod trying to pairing to device:
<pre lang="cs">foreach (BluetoothDeviceInfo device in availableDevices)
    if (!device.Authenticated)
    var peerClient = new BluetoothClient();
    peerClient.BeginConnect(device.DeviceAddress, BluetoothService.SerialPort, this.BluetoothListenerAcceptClientCallback, peerClient);

-how i can sending a file ?
-how i can conecting without pincode?
Updated 5-Jan-14 5:26am
Kornfeld Eliyahu Peter 5-Jan-14 3:51am    
It's not a good question.
If you done some coding and stuck with it then let see us your exact problem.
If you are just starting, than do some research (Google?) and than come back to ask...
h.k_net 5-Jan-14 4:31am    
i reading somthing aboute 32feet and using but i can't using correct from it.for example how i can geting mac address of blue tooth device to using for BluetoothDeviceInfo class. or what is Guid class and what mean
readonly Guid OurServiceClassId = new Guid("{29913A2D-EB93-40cf-BBB8-DEEE26452197}");
Kornfeld Eliyahu Peter 5-Jan-14 4:37am    
Good! Go on with that, and than show us the code you have and the point you stuck or don't understood so we can give you some advice!
Update the original post with tho code...
h.k_net 5-Jan-14 4:49am    
for example can u solve this cod?
bool inRange;
Guid fakeUuid = new Guid("{F13F471D-47CB-41d6-9609-BAD0690BF891}"); // A specially created value, so no matches.
BluetoothDeviceInfo device = ...
public void sample()

InTheHand.Net.Sockets.BluetoothClient bc = new InTheHand.Net.Sockets.BluetoothClient();
InTheHand.Net.Sockets.BluetoothDeviceInfo[] array = bc.DiscoverDevices();
int count = array.Length;
for (int i = 0; i < count; i++)
Device device = new Device(array[i]); // dont worry.Device is an abstraction of the BluetoothDeviceInfo class .
if (device.DeviceName == "XXXX")
var addr = device.DeviceAddress;
//array[i].SetServiceState(BluetoothService.HumanInterfaceDevice, true); // This is not needed OS not involved

if (addr == null)

if (!BluetoothSecurity.PairRequest(addr,null)) // Is this correct ?
Console.WriteLine("Request failed");

var ep = new BluetoothEndPoint(addr, OurServiceClassId);// Is thiscorrect?
catch (SocketException ex){}
Kornfeld Eliyahu Peter 5-Jan-14 4:57am    
if (!BluetoothSecurity.PairRequest(addr,null)) // Is this correct ?
Why you ask if this correct? You have error on this line? null as pin is considered to be correct?

var ep = new BluetoothEndPoint(addr, OurServiceClassId);// Is thiscorrect?
As before, why you ask?

At glance it seems to be correct on the syntax-part, however it's not clear why you ask it it's correct?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900