Bluetooth SPP server on Windows - c#

I need to write a Windows application that accepts connections over Bluetooth SPP - i.e. other devices can see the SPP service and connect there. Tried googling but not much information available - any examples/meaningful docs/pointers out there?
The OS is Windows 7, using native Bluetooth drivers.
The preferred language is C#, but other ideas are welcome as well.

32feet.NET seems the obvious choice? http://32feet.codeplex.com/wikipage?title=Bluetooth%20Server-side
Speaking as its maintainer... :-,)

Related

Is it possible to have our windows Handheld application as a USB receiver?

apologies if the question is quite basic, I am inexperienced in USB programming and I might be missing some conceptual detail here.
For our industrial solution we are supposed to provide communication between our PC wpf application and windows embedded HH 8.1 application. Ideally we would like this to be over USB.
I see a lot of sample code to connect directly to USB devices from host role.
However in our case the Windows Embedded HH device (Panasonic FZ-E1) will have the device role listening. I could not find any way to register to raw data sent from our PC application via USB events. I examined UMDF (user mode driver framework) which has examples about writing drivers for usb devices, yet it seems like it is for device manufacturers and us not being the manufacturer for Panasonic HH we should not/cannot use our own driver and we have to use the WinUSB driver it already has in place.
Windows Embedded 8.1 HH has some USB apis unlike windows phone, yet all the functionality provided in the API seems like connecting to external USB devices with the host role. When we use USBlyzer I see that there is some USB traffic towards the device from the PC so it looks it should be possible for the HH to have the listening device role. What am I missing here, any ideas?
Any help/direction is greatly appreciated.
P.S: I also tried windows connectivity api examining the source code of windows phone power tools yet it seems like the the dlls for addon packages here to handle transfer via agents is not there for newer versions of windows phone anymore.

How to accept incoming bluetooth connection on Windows 7 desktop (with a c++ or c# program)

I am writing a BT app on an android to connect to a lab device/hardware. At the present time I have a device on loan. However it is not possible for me to always have one while I am developing for it, (commuting, out of town, etc) Therefore I am creating an emulator for it and will run that emulator on my Windows desktop so that my Android client code can make connections to it.
The android code is built with .NET/xamarin and works fine connecting to the real device.
I am comfortable with C++ or C# on the desktop.
I have found this code http://www.codeproject.com/Articles/252882/Bluetooth-Server-Programming-on-Windows online to create and accept BT connections. it looks like a very good start for what I wish to do - which is build a state machine/emulator to mimic the real device. However I have been unable to connect my android device to it.
Note - the connection is a serial port connection. (the UUI coming from the android device is the "well known" serial port connection ("00001101-0000-1000-8000-00805F9B34FB")
I am not sure how to configure the windows 7 desktop and bluetooth services to allow this server/emulator program to accept connections.
I have paired the devices, but unable to connect.
How can I accept incoming Bluetooth serial connections in the C++ or C# code running on Win7 desktop?
If you want to do low level stuff like establish a connection via bluetooth through a C# app then you will need to access the bluetooth stack via its API. If your device is running the Microsofts Bluetooth Stack then you can look at 32feet.net's managed wrapper for Microsofts Bluetooth API. If you have the Widcomm stack then you will have to locate Widcomm's API for it.
To access the microsoft bluetooth stack, you can use the BthUtil.dll.
BthUtil.dll is an unmanaged dll which is part of the Microsoft Bluetooth stack. It's typically utilised for tasks such as turning the bluetooth radio on or off via a function called BthSetMode
(see MSDN for documentation - http://msdn2.microsoft.com/EN-US/library/aa456007.aspx)
You can check the following links:-
http://www.youtube.com/watch?v=Jn05CU3mxzo
Also, check the 32feet.Net
A Brief description of 32feet.Net
32feet.NET is a shared-source project to make personal area networking technologies such as Bluetooth, Infrared (IrDA) and more, easily accessible from .NET code.
Supports desktop, mobile or embedded systems.
32feet.NET is free for commercial or non-commercial use.
If you use the binaries you can just use the library as-is, if you make modifications to the source you need to include the 32feet.NET License.txt document and ensure the file headers are not modified/removed. The project currently consists of the following libraries:-
Bluetooth
IrDA
Object Exchange
Bluetooth support requires a device with either the Microsoft, Widcomm, BlueSoleil, or Stonestreet One Bluetopia Bluetooth stack. Requires .NET Compact Framework v3.5 or above and Windows CE.NET 4.2 or above, or .NET Framework v3.5 for desktop Windows XP, Vista, 7 and 8.
Link
http://32feet.codeplex.com/
Feature link for 32feet.Net
http://32feet.codeplex.com/wikipage?title=Feature%20support%20table&referringTitle=Documentation

C# Monotouch/Xamarin - iOS Bluetooth connection to multiple phones?

Does anyone know if it's possible to use Bluetooth to connect to multiple phones using C# Monotouch/Xamarin iOS?
Update
I'd preferably like to connect multiple phones to one main phone
host, all via Bluetooth (1 host and 3 or 4 clients).
I don't know a
great deal about bluetooth and the various profiles, so I'd be
looking for guidance on this aspect also.
Yes, you can.
iOS 7.0 introduced the Multipeer Connectivity framework. It can work with both bluetooth and/or wifi (and can even bridge between them, pretty neat).
You can find sample code (e.g. chat, mixed with iBeacons) by googling around for Multipeer Connectivity, iOS and monotouch.

Is it possible to connect a Win RT app with PC via Bluetooth?

I am trying to find a sample that connect a Win RT app with other Bluetooth devices for example a PC. It is a basic thing but seems like it is not supported in WinRT.
In one thread a Microsoft employee says
.... Other than the call control sample, there is no Bluetooth stack
available for Store apps...
After reading other similar threads it seems to me that this is not possible at the moment. Am I right or is there any way to connect a Win RT app with some other device like a desktop app on PC via Bluetooth?
After reading many questions and articles (some links are below) on different forums I have reached to conclusion that communication between a Metro Style App and a PC is not possible via Bluetooth. One option is to go with is WiFi.
Some useful links which supports this conclusion are below
http://social.msdn.microsoft.com/Forums/en-US/tailoringappsfordevices/thread/6634240b-c042-4e76-a3b0-1f1103ea0ddf
http://social.msdn.microsoft.com/Forums/en-US/tailoringappsfordevices/thread/0cb2a6c1-d1f1-4872-aa32-709acd90b94d
http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/9db327e1-afe4-443b-8856-343492645083/
http://social.msdn.microsoft.com/Forums/en-US/tailoringappsfordevices/thread/172061f4-56ff-4fd2-987d-687d4703506d
The WinRT 8.1 Bluetooth stack provides the requisite services for ad hoc Bluetooth communications with similarly capable devices. More specifically, peer discovery and peer to peer communications is supported.

Ad-Hoc wireless network in C#

I would like to auto-create an ad-hoc wireless network from my laptop.
I use windows XP SP3 and I want to do it using C#.
I have seen some libraries for mobile, but I havent found something regrading PC.
Is there an API to do that ?
Thank you.
Ad-hoc network are usually used in Ubiquitous Computing (smart homes). For a laptop, it depends what you'd like to connect to, as ad-hoc usually work with many devices you control.
May be you mean connecting to whatever network you can, in which case it's more on the OS-level.
If you are willing to setup one machine on the network as a wireless server and forgo Ad Hoc, then the Managed Wifi API on codeplex looks very promising. It is in C# and works on XP SP3 and higher (and a little bit on SP2, fyi). http://managedwifi.codeplex.com/
It uses the Native Wifi API from Microsoft. The Native Wifi API requires you to have a server machine which will hand out private IPs to other devices that connect to the network you create. In Native Wifi you would want StandAlone mode ICS in order to create your network (if you want internet access on your network use full ICS then).
http://msdn.microsoft.com/en-us/library/windows/desktop/dd815252(v=vs.85).aspx
Use the Native Wifi as just a reference though, Managed Wifi API is what you will want for C#.
I'm interested in this too actually. I think this could be useful:
http://msdn.microsoft.com/en-us/library/ms705973(v=vs.85).aspx
Unfortunately, this is only available for Windows 7 and Windows Server 2008 I believe.
I don't know any c#, but if I did, it'd probably make sense. If you find any insight, please contact me, I'd also like to learn how to do this as well.

Categories

Resources