I am working on a project for college that involves bluetooth. I was required to use .Net. I have only programmed in C before, and therefore have started to teach myself C#. I have written all of the program already, including sending the data over a bluetooth connection. The only part I am having difficulty with is scanning for bluetooth devices in the area.

Can anyone give me any ideas on how to go about doing this or sample code.

Thanks a lot,
Tim

Recommended Answers

All 33 Replies

hi hi,
sorry, i can't offer any advice on your question, but t'm interested to know how your project has gone. can you share with me what tools or informational links you used for your project.

anyone else has any information on how to makeuse of bluetooth devices

This is absolutely not true! I haven't done bluetooth in C# before, but I've done it in C/C++ and am familiar with the bluetooth protocol. You need to just do a device inquiry over sdp (Service Discovery Protocol). This is not vendor specific---A Huge Nightmare if it was vendor specific!!! Look in your API for SDP I'm sure you'll find something. If you decided instead to run Linux and bluez then I could help you :).


Ed

it looks like it's specific for each blue tooth device. You'll need a BlueTooth SDK from the hardware vendor and then use PInvoke to access it's functions.

Can you please share some of your code to how we able to read from the bluetooth device, and respond.

- Thanks.

Hi, maybe late, but here is a good place where you can find example code about how to perform SDP, with microsoft's bluetooth APIs:

http://www.lenholgate.com

About data transfer between devices, I'm still working on it. I'm new to visual C++ and MFC, so I'm finding a little bit difficult to achieve the goal of creating a piconet. I think now I am close to it, and if any one knows anything about the topic of bluetooth piconets, don´t hesitate contacting me.

Hi Tim, I am not sure but maybe u could use OBEX to

Hi Tim,
I am not sure but maybe u could use OBEX to discover the Bluetooth devices around the area and connect to it?
By the way, I am interested in your application, care to talk/post your code?
I am doing a C# application to communciate between desktop and PDA.
I have problems converting the VB .NET application found at http://www.devx.com/wireless/Article/11511/0 to C# application.
Please assist
Thanks.
Clement

I am working on a project for college that involves bluetooth. I was required to use .Net. I have only programmed in C before, and therefore have started to teach myself C#. I have written all of the program already, including sending the data over a bluetooth connection. The only part I am having difficulty with is scanning for bluetooth devices in the area.

Can anyone give me any ideas on how to go about doing this or sample code.

Thanks a lot,
Tim

I am also involved in a project where I use a bluetooth usb dongle connected to the PC(which communicates with other bluetooth devices). So can I know " what would be the most suitable programming language in developing my own application programs for that USB bluetooth dongle?". Please help me with this.

Hi Udara,

Hmm well first you have to understand what are u trying to achieve here.
Do you have to write a bluetooth service discovery protocol? (discovering all other bluetooth devices in the area)? I am not a expert in this area. I was just involved in some preliminary Proof of Concept hence I coded in C# which was easily to communciate with PocketPc. 1 other thing you have to understand is which USB dongle you are using, there are 2 main types of Bluetooth stack : WIDCOMM and Microsoft. Maybe you could try to search and see what other help you could get from the net. I will be pleased to assist you in any way possible if I have time to check my email. :)

Regards

Hi Udara,

Hmm well first you have to understand what are u trying to achieve here.
Do you have to write a bluetooth service discovery protocol? (discovering all other bluetooth devices in the area)? I am not a expert in this area. I was just involved in some preliminary Proof of Concept hence I coded in C# which was easily to communciate with PocketPc. 1 other thing you have to understand is which USB dongle you are using, there are 2 main types of Bluetooth stack : WIDCOMM and Microsoft. Maybe you could try to search and see what other help you could get from the net. I will be pleased to assist you in any way possible if I have time to check my email. :)

Regards

i want to discover devices wiht using c#, which is in my area. then store their mac addresses in a string array or whatever, can you help me about this topik.

i working on a scurity system and i searched some Win APIs and commands for that but i cant find enoug article about that topik

if you can help me please send me a email (celikada@hotmail.com)

thanks a lot :)

i searched a way a lot of time to reach bluetooth devices which are in my range but i cant find an easy way. but some people wrote some dll files then they used these in a namespace for .net. but it is expensive to use just device discovery. this namespace name is franson if you pay 99$, you can easily access a remote device but i have to say that i did not try , sorry :(

i searched a way a lot of time to reach bluetooth devices which are in my range but i cant find an easy way. but some people wrote some dll files then they used these in a namespace for .net. but it is expensive to use just device discovery. this namespace name is franson if you pay 99$, you can easily access a remote device but i have to say that i did not try , sorry :(

there is an easy way[/a]

32feet.net

free sdk for c# but but its works whit windows bluetooth stack

add your project referances InTheHand.Net.Bluetooth.dll

define libraries InTheHand.Net , InTheHand.Net.Socet

and add the code

BluetoothClient blue_client = new BluetoothClient();


BluetoothDeviceInfo[] devices = blue_client.DiscoverDevices();

bluetooth devices in the devices array

thats it:)

Thanks for your advice. But the thing is I was trying on the microsoft bluetooth stack, with Java (using BlueCove ), but didn't get resu;ts as there were errprs and also it requires Winows XP SP2 compatible bluetooth dongles. I don't know much about WIDCOMM stack. And also I'm free to try C++ or even C# with Microsoft Bluetooth Stack or WIDCOMM stack. So what would be the best way to go, bcos I don't have much time left for the project. And what is your opinion on my way (using Java & Bluecove on Microsoft stack)... ?
Can you pls help me on this......:confused: :confused: :confused:


Hi Udara,

Hmm well first you have to understand what are u trying to achieve here.
Do you have to write a bluetooth service discovery protocol? (discovering all other bluetooth devices in the area)? I am not a expert in this area. I was just involved in some preliminary Proof of Concept hence I coded in C# which was easily to communciate with PocketPc. 1 other thing you have to understand is which USB dongle you are using, there are 2 main types of Bluetooth stack : WIDCOMM and Microsoft. Maybe you could try to search and see what other help you could get from the net. I will be pleased to assist you in any way possible if I have time to check my email. :)

Regards

hello
where to get WIDCOMM bluetooth SDK ?
does it implemented as c# class's or as VC++ API's ?

if you want to pay you can find
i cant find a free one

Hi,

As celikada already mentioned there are different bluetooth stacks available and Microsoft hadn't provided one till XP SP2 (if I'm not mistaken) still most USB BT dongles install their own stacks either WIDCOMM or another proprietary one. I suggest too the 32feet.net 's BT classes and if it fails (in a try catch block) then this means that no MS BT stack then you check for the presence of Widcomm DLLs and use P/Invoke. Check Widcomm's site for C SDK.

Loren Soth

Hey guys ... Kinda have a situation here. I am trying to build an application using InTheHanad.Net library but I am using a Qtek 2020i which uses a Widcom stack. The test programm is not workig. Any suggestions are welcommed. Thanks.

This is absolutely not true! I haven't done bluetooth in C# before, but I've done it in C/C++ and am familiar with the bluetooth protocol. You need to just do a device inquiry over sdp (Service Discovery Protocol). This is not vendor specific---A Huge Nightmare if it was vendor specific!!! Look in your API for SDP I'm sure you'll find something. If you decided instead to run Linux and bluez then I could help you :).


Ed

Hi
i m trying to develop an app , with C++ / C# to detect the device which wantst to connect to the pc , via bluetooth and to connect it to the pc

this is also done by widdcomm , but what should nt be there is the diaalog window for the pin entry , i plan to read the pin from a list inside the pc
and automatically connect to the pc

u mentioned u have done it in C++ , could u give me leads to
- detect device wanting to connect via bluetooth
- connect to that device with pin

regards
kpmkkhaja

i badly needed a program for transfering data over bluetooth. can anyone you help me there!

I have been involved in a project where we needed to handle the bluetooth events and lately have found a dll for WIDCOMM bluetooth that supports C#. its name is franson found in www.franson.com, but it is 14 days trial only, else you can buy it.
the 32Feet dll doesn't support WIDCOMM, but supports Microsoft stack only!!
And for lamuk, what kind of software do you want? I didnt get you.

hi
I want to transfer data from one device to another device, how to send data?
Thanks a lot

I am working on a project for college that involves bluetooth. I was required to use .Net. I have only programmed in C before, and therefore have started to teach myself C#. I have written all of the program already, including sending the data over a bluetooth connection. The only part I am having difficulty with is scanning for bluetooth devices in the area.

Can anyone give me any ideas on how to go about doing this or sample code.

Thanks a lot,
Tim

Hey,

I'm working on a very similar college project as with tadhg and udara. I just need a way to program my computer with a bluetooth dongle to detect bluetooth devices in the area. So far, I can only do this with the BlueSoleil program that was package with the dongle. It seems that a lot of people have been working on this, but I can't find out how they actually did this. Any help at all would be most grateful.

-anson

By using 32 InTheFeet libraries, I have manage to identify and get the bluetooth enabled devices mac addresses to an array. I use a timer to refresh the list but for some reason it won't refresh. the past discovered devices remains in the list even they are off. how can i avoid this. and the program get crashed when trying to close. please help. I am developing the system using C#

Hi
i m trying to develop an app , with C++ / C# to detect the device which wantst to connect to the pc , via bluetooth and to connect it to the pc

this is also done by widdcomm , but what should nt be there is the diaalog window for the pin entry , i plan to read the pin from a list inside the pc
and automatically connect to the pc

u mentioned u have done it in C++ , could u give me leads to
- detect device wanting to connect via bluetooth
- connect to that device with pin

regards
kpmkkhaja

I am new to this bluetooth stuff. i am trying to block the bluetooth devices connected to PC to transform some data from/to PC in a Network(Intranet)...

could you give some guidelines how to do it? what programming language will be best?

It is urgent...

Thanks a lot in advance..

Hi k4kasun, you are working on excatly what i am looking for, did you get the refresh-thing to work, and are you interested in sharing your project? :)

Lars

dude.. in C,.... by using.. bioscom.. command.. u can easily detect da devices.. in da surrounding area.. can u tell me.. how to transmit the data... i need C commands for transmission of data.. via bluetooth... plz rpely soon.. dis is my email.. email is dissed

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.