How to receive Bluetooth-Data as Controller Input?

We are currently working on a project in which we try to use android-smartphone sensor data as cotroller input of our unity-(windows)-desktop application.
We managed to program a bluetooth SPP server for C# but couldn’t integrate the server into Unity3d. Our Bluetooth-Server does wait for incoming bluetooth-connections and accepts them (thanks to the 32feet.Net libary). As soon as the client has connected to the Server it should tranfer String-data over a stream.

Now the problem is, that Unity won’t accept any GUID we create for our server (see code below).
Is there a way we can set up a bluetooth server in a other way in unity/c# (we are used to java programming) or could we start the bluetooth-Server with “normal” .Net 3.5 and stream the data into unity ?

this is some code we tried. as we mentioned, unity won’t accept our guid:

using UnityEngine;
using System.Collections;
using BluetoothServerDLL;
using InTheHand;
using InTheHand.Net;
using InTheHand.Windows;
using InTheHand.Net.Bluetooth;
using InTheHand.Net.Ports;
using InTheHand.Net.Sockets;
using System.IO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


public class BlueToothControler : MonoBehaviour
{

    public static CharacterController BtController;
    public static BlueToothControler Instance;
    public BluetoothServer bts;

    public Stream mStream;
    Guid mUUID = new Guid("00011111-0000-1000-8000-00805F9B34FB");

    // Use this for initialization
    void Awake()
    {
               //set up server
        try
        {
            //unity won't accept the mUUID in the next line
            BluetoothListener blueListener = new BluetoothListener(mUUID);
            blueListener.Start();
            BluetoothClient conn = blueListener.AcceptBluetoothClient();
            mStream = conn.GetStream();
        }
        catch (Exception e)
        {
            print(e.Message + "

");
}

        // Set up Player Control
        BtController = GetComponent("CharacterController") as CharacterController;
        Instance = this;
    }



    // Update is called once per frame
    void Update()
    {

        if (Camera.main == null)
        {
            return;
        }

        
        //receive data and use it as controller input
        try
        {
            //handle server connection
            byte[] received = new byte[1024];
            mStream.Read(received, 0, received.Length);
            String moveString = Encoding.ASCII.GetString(received);
            print("Received: " + Encoding.ASCII.GetString(received));
            //OnRaiseMoveEvent(moveString);
        }
        catch (IOException exception)
        {
            print("Client has disconnected!!!!");
        }

        PlayerMotor.Instance.UpdateMotor();
    }


}

thanks in advance.

Hi, do you solved this problem? I am trying to connect a balance board in unity but i am a little new in this library, could you help me please?

Hi everyone! I’m developing an app for Android with unity 3D. I need that i include script in my actuel script to send app via bluetooth to another device for making vibration ( my app it turn on active vibration using smartphone coding by c#)

please give me the suggestion.