For a medical application I have sensors that can send (HEX) data over Bluetooth. I would like to use this data in Unity to give visual feedback to users. I already have a working Bluetooth connection via Serial Port but the Program should search and connect the device dynamically. I also build a Visual Studio application by using the 32feet.net API and it works fine. But it should work with Unity in C#. Is there an API like the 32feet.net in VS for Unity? I am not sure if the 32feet.net API runs with Unity as well, but I was not able to make it work. If there is a documentation how to implement 32feet in Unity it would be great. Otherwise I need another opportunity to communicate with my bluetooth device (except using serial port).
EDIT: SocketException: An address incompatible with the requested protocol was used.
Related
I have an issue connecting my Unity application on Hololens to a (haptic vest) Bluetooth. The problem is there is no SDK for Hololens to connect to the Haptic vest.
**- I want to maintain a connection between my HoloLens unity app and the haptic vest but cannot figure out how.
There is an Android SDK for the Vest but I am confused about how to use it with my application. For example, I connect my Hololens to Android, and then I send events from my unity application to android to play a specific pattern because the android Bluetooth pairs with it only.
I read about sockets TCP or UDP connection but I have no idea how this can be achieved. I am not an advanced-level programmer but just a rookie.**
Please help me regarding this issue, been stuck now for a month...
Does the haptic vest only provide Android SDK? It is easier if there is an C# SDK.
However, it is possible If you want to have an Android device to host the bridge between HoloLens and the vest.
You may simply add a TCP/UDP Client on HoloLens. For the Android project, basically there are 2 things to do. Adding a TCP/UDP Server and implementing the haptic vest SDK. There are plenty of steps to build the system and the configuration steps for players may take long. The player needs to open Android app to pair the vest, then start TCP/UDP server. Then the player open HoloLens App, find the TCP/UDP server in the local network (maybe manually input IP address). The game starts when the connection is established.
Apar from HID and Audio devices, HoloLens 2 supports the following Bluetooth APIs:
GATT
Server and Client
RFCOMM
If your vest doesn't support accessing via the above APIs, you may need to refer to the previous answer to set up the connection. If you have further questions on HoloLens Bluetooth, you may submit a support ticket via http://aka.ms/hololenssupport
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.
I want to develop an app for the Windows Phone app store that communicates with my car's OBD2 port via Bluetooth.
Long story short, the app will use the bluetooth serial port to send a hex value and retrieve the corresponding value in the ECU's register. There's an android app called Torque which does this.
I can't figure out how to use the serial port though. The only bluetooth functionality mentioned is high-level stuff like pushing objects, pairing, etc. But nothing about setting baud rates or writing to a specific COM port.
Is this possible on WP7/*? Or alternatively, how can I make this possible and get my app approved for distribution?
UPDATE: I haven't been able to get my hands on a WP8 device yet, so I can't verify whether or not this is possible using SSP.
As a bonus note in case you came here looking for alternatives: you can also NOT connect to ad-hoc wifi connections, so the wife-based OBD2 adapters are no good either. There is an ugly way of connecting to the latter which involves having a laptop in your car which is simultaneously connected in ad-hoc mode the the device and is also acting as a wifi hotspot. It is utterly impractical.
Using the Bluetooth Serial Port (SSP) is not possible with public APIs of Windows Phone 7.x. As you've kind of guessed already, the app will likely not be approved for the marketplace if private APIs are P/invoked or otherwise used.
Consider upgrading to Windows Phone 8 as the Bluetooth SSP is partially available there, see Nokias Developer site for example.
I took me several time and days to research and try some codes applicable to my problem but unfortunately I wasn't able to see codes that pair and receive files (text, images etc..NOT audio or video in particular) from a mobile device.
Most of the examples found are for SENDING only (From PC to Mobile).
I have bluetooth device (USB) physically attached to my PC.
Summary:
All I need is a sample code that automatically detect/pair when a device is trying to send the file (like in Kodak kiosk but not limited to images only).
I also wanted to understand and study the code.
Perhaps use my 32feet.NET library and its ObexListener class see e.g. http://32feet.codeplex.com/wikipage?title=Server-side&referringTitle=OBEX
For more advanced scenarios use Andy Hume's Brecham.Obex library and his server sample application. See http://inthehand.co.uk/files/folders/objectexchange/entry9942.aspx
Which Bluetooth stack does your PC have installed? Microsoft, Widcomm, BlueSoleil...? See e.g. http://32feet.codeplex.com/wikipage?title=Supported%20Hardware%20and%20Software On Widcomm for instance the build-in OBEX server would have to be disabled to allow your server to get all the incoming connections...
I am developed a app in Visual Studio with mono for android. C#
So. How can i send data by USB port in Android. C#?
The type serialPort1.Write("1");
Long story short - you can not do it the way you intended. USB is not a serial port that you can just write to and data comes out on the other side.
Serial ports can be emulated over USB, but Android does not support that. Android typically can act as device that offers different profiles: disk, camera and proprietary debug (if enabled on device).
Since Android 3.1 you also have two special modes: host mode where Android device acts as a host to usb devices (much like PC does) and special proprietary accessory mode. Read more about it here: http://developer.android.com/guide/topics/usb/index.html
Start here: Android USB Api