C# - Windows Mobile - Bluetooth Pairing - c#

I've been given the task of building a Windows Mobile app for our company that quickly pairs a device by scanning it's bar code. I can discover the device, and talk to it, but I am stuck as far as pairing.
In C# / Windows Mobile 6, how do I pair a device? I don't really need to talk to the device within the app, I need to pair it so other applications can use it.
Is there an API I need to do this? I've seen things saying I need to register a pass key, etc? I can't seem to find any documentation on the actual pairing process, just connecting to it. (Just connecting to it, doesn't actually pair it.)

You can use my library 32feet.NET. Use method BluetoothSecurity.PairRequest See e.g. Bluetooth Security (That should work regardless of whether the device has Microsoft's own Bluetooth stack installed or the device has Widcomm/Broadcom or SSO Bluetopia).
The process of 'pairing' should also enable the services at the same time. If not we probably have other APIs for that too. Which services are used? SerialPort, others?

Related

Windows iot/apps Programmatic Bluetooth Pairing

I'm trying to broadcast a bluetooth signal from a Raspberry Pi 2 running Windows Iot Core so that I can connect to it from smartphones and other devices, but I've been stuck for the last couple days on actually receiving a pairing signal.
Using the Windows Bluetooth docs I am able to broadcast the signal and I can see it from my desktop as well as from my phone.
However, this is as far as I can get. I want to be able to pair without a PIN (the device will not have a screen), but the pairing fails any time the device is selected.
I am using
SocketProtectionLevel.BluetoothEncryptionAllowNullAuthentication
and
DevicePairingKinds.None
But the connection callback is never hit. I have looked at many similar questions that are either unanswered or do not have the appropriate information since I am using an RPI2 and not a desktop app.
I am not looking to pair via the web interface, but simply through code
.
[UPDATE]
I've tried the 32feet.NET library but it appears to be too old to support the PI2.
I also tried a few NuGet packages, nothing seems to work yet.
I am not master in IoT but recently, I have started exploring it so I know Raspberry Pi 2 is hardware and we can use it to develop some basic IoT device/concepts. I can not help you with the code but may be with some idea.
I remember, for making any embedded system, we used serial port of pc and transferred command to devices. Something similar I found in one of the tutorial from David Jones. It is about to connect Bluetooth to windows 10 using serial port.
In both the explanations, SPP (Serial Port Profile) is used and also Universal Windows App is referenced. May be you get some start point or spark to comlete you work.
Check this and this. It also uses RPi 2.

Serial Port Comm with Arduino Device from Windows Store C# App

I'm currently working on getting a Leonardo device recognized and communicating with my app over a serial port in C# for the Windows 8 App Store. I'm using http://msdn.microsoft.com/en-us/library/windows/hardware/dn312121(v=vs.85).aspx#step2 as a guide, in conjunction with http://code.msdn.microsoft.com/windowsapps/USB-CDC-Control-sample-5ba19caa to guide me.
I'm having problems however in the sense that my Arduino device isn't showing up despite me entering my PID/VID and Class/Subclass/Protocol so I feel I'm missing some steps and was hoping someone that has experience with this could point me to a more specific/granular example.
My device is an Arduino Leonardo and I'm running windows 8.1 using Visual Studio 2013 Ultimate, code is in C#
Any help is appreciated!
Just general thoughts on regular windows applications (not aware of W8 AppStore):
Might help or might not, in the second case, sorry for wasting your time...
To get a "regular COM" device in Windows, without any additional drivers, you should make the device appear as USB Communication Device Class (aka CDC) - this is, among others, done via the appropriate class/subclass/protocol. The VID/PID don't care. This means the device should provide CDC/ACM USB descriptors to the enumerating USB host (windows) and implement the required endpoints and commands - supposedly there is already something existing for your board and you downloaded the firmware to it, right? You might want to try to connect such configured device to windows and after successful enumeration, new COM port should appear. If you program regular application, you just connect to such COM port via SerialPort class instance, no matter it is provided via USB subsystem... If this works, you should be able to start the AppStore part (where I have no clue how to help).
I'm just going to answer this as not currently possible. I ended up writing a desktop WPF application using metro UI/UX guidelines. Between that and ClickOnce deployment the store app feel is fairly well recreated, despite the store being ideal.
I sincerely hope that Microsoft decides to support this in the near future, the Metro SDK is really nice and I would love to eventually port it.

GPS Windows Mobile 6 (using Microsoft.WindowsMobile.Samples.Location;)

well guys, i am part of one team. (I dont have the project yet, i am new).
They did a application using gps, problem is it fail sometimes...
why? they think gps fails because users has the device in "energy saving" mode; then the device hibernates
after 5 minutes if they dont use it.
GPS brings sometimes bad coordinates (for example coordinate shows users is on "SEA" or in "Japan". I repeat, My partners thinks problem is because device is in "energy saving" mode. how can i change this configuration with C# while application is running (maybe back old configuration when application has been closed).
I am using this library.
using Microsoft.WindowsMobile.Samples.Location;
I can't check if it works because now i dont have a device, and i my computer doesn't have GPS, do you have any idea for i can check the application?.
i am using
`"Windows Mobile 6.0 SDK"`
You can install networking functionality while using the Microsoft Device Emulator. This blog explains how to setup network functionality on Windows 7. Follow the official documentation if you're not using Windows 7.
You can emulate GPS functionality using the FakeGPS program supplied by Microsoft. If you want anything close to real data you'll need a text file containing raw NMEA to feed into FakeGPS. You can simply record bytes passed through the GPS COM port to a file to generate a NMEA file. If fake GPS doesn't like your file then remove the non-standard NMEA lines and try again.
You should do some research on Windows Mobile Power Management first to understand the problem. The quickest hack is to simply call SystemIdleTimerReset() more frequently than the battery idle timeout (use SystemParametersInfo() and SPI_GETBATTERYIDLETIMEOUT) to prevent the device from sleeping. This will decrease the battery life of the device! There are other more elegant solutions available such as using the Power Management API.

Reading SMS messages off Windows Mobile phone connected via ActiveSync?

I have a project I'm working on that requires our WPF application read SMS messages off of a user's connected Windows Mobile phone so we can display recent ones, etc.
I've had little luck with any of the libraries I've found. Most promising seemed to be OpenNETCF.Desktop.Communications but ultimately it seems like I won't be able to do what I need to with it.
What's the best way to read SMS messages off of a connected phone? Will it just be easier for me to write some sort of service app for the phone that acts as a server and our WPF app as the client?
Thanks!
There's nothing out-of-the-box that will do what you want. RAPI, which the OpenNETCF library wraps, has a set of communication APIs, but nothing for SMS. It does have the ability to snap-in custom APIs, so you could create a custom API and use that. The advantage with this strategy is you don't need any user intervention to get stuff onto the device (no copy and run of a service app stuff). The down side is that the custom RAPI DLL for the device must be native code.
If you go with your own mechanism, you can then use the POOM APIs in managed code to get the messages and ship them. The only challenge there is that you have to run some form of a "service" app on the device to listen for calls, which means writing your own protocol, which means a fairly large test matrix.
Jeyo have a product that pulls SMS messages from a phone into outlook PST files. Strikes me that you could just use that product and trawl the PST for recent messages (bit of a kludge I know, but if you were desperate) or talk to them about if they'll licence some of their code for you?

Windows Mobile - Device to Device via WiFi?

Are there any good api's or examples of communicating between two devices via WiFi?
I am programming an app for 600 window's mobile (version 5) devices. They occasionally will need to connect with another device and exchange info.
Each device connects to the internet via GPRS (using the phone line). I could do the communications via that, but it is slow and may not work in all locations (this app will be used nationwide).
Just as an FYI, I also plan to look into bluetooth, but the stack we get on our Symbol Devices (MC70) is the Stonestreet One stack (we cannot change that). It is a very difficult to use stack with no managed code API. Also, it requires manual setup to use. My users will not be very technically inclined.
If there is another way to communicate (ie via the WiFi connection) I would love that.
(Ideally, I would like to be able to programmatically turn on the WiFi, send/receive data and then turn off the WiFi (to save batteries).)
Any help/suggestions are appreciated.
Motorola (who have bought Symbol a few years ago) do release an Enterprise Mobility Developer Kit for .NET CF which also has some libraries for controlling the WLAN on a Symbol MC70. I have worked with this in the past and it seems to work very well. The SDK comes with the full documentation and some sample applications.
Here is an earlier question on this subject:
better way to communicate between ad hoc wifi windows mobile devices
... which suggests that this is at least possible.
As an alternative, if the devices have infrared ports, you could have them communicate that way (I think).
Update: just found this example:
http://community.opennetcf.com/articles/cf/archive/2008/06/09/exchanging-data-using-windows-mobile-windows-communication-foundation-net-compact-framework-and-exchange-2007.aspx
It looks like you can do peer-to-peer communications with it. It requires .Net CF 3.5, however.
Someone is welcomed to prove me wrong but, as far as i know, out of the box it has to be bluetooth. WiFi is for networks. If you setup each device to also act as an access point you could make this happen. So I am sure it can be done, but it's not a clear path.
I see other issue slike security as well, because a router would handle this and now each of the 600 devices would be an access point handling this security, i am just shooting from the hip now which is basically my long winded advice to not go that direction.
-update
maybe i am a bad answerer, I just thought this was a bad direction. You can google windows mobile wifi peer to peer. Here is one site that covers it.
http://www.smartphonemag.com/cms/blogs/3/588

Categories