我的UUID适用于智能手机Samsung j5,但不适用于我的Moverio BT-350。为什么?

使用Unity(因此在C#中),我制作了一个Android手机应用程序,该应用程序通过蓝牙与PC窗口进行通信。问题是,当我在智能手机Samsung j5上运行apk时,一切都很好,当我在另一部手机或Moverio BT-350(始终为Android)上运行相同的apk时,我无法建立蓝牙连接,并且我得到一个错误。显然,当我从一台设备切换到另一台设备时,我更改了该设备的蓝牙MAC地址。我不会更改的是UUID。实际上,我相信UUID是问题所在。但是我应该如何改变呢?如何分配有效的UUID?

如果我尝试与用Visual Studio编写的C#中的一个非常琐碎的程序通信apk,也会发现相同的问题。如果输入J5的MAC地址,但如果输入Moverio或其他单元的MAC地址,此方法也很好。

为简单起见,我报告了此应用程序的Windows代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using InTheHand.Net.Bluetooth;
using InTheHand.Net.Sockets;
using InTheHand.Net;
using System.IO;

namespace BluetoothForWindows
{ 
    public partial class Form1 : Form
    {
    // this is the UUID,i have no problem with J5,but i have problem with Moverio
        Guid mUUID = new Guid("c1db6770-a359-11e6-80f5-76304dec7eb7");
        bool connect = false;
        BluetoothClient client;

        public Form1()
        {
            items = new List<string>();
            InitializeComponent();
        }

        private void bGo_Click(object sender,EventArgs e)
        {
            client = new BluetoothClient();
            updateUI("attempting connect");
            // When I set the MAC address of J5,that is 14:9F:3C:92:12:06,//I have no problem,when I set the MAC address of Moverio,that is 9C:AE:D3:74:83:D9,//I have Connection Failed Error 
            BluetoothAddress address = 
            BluetoothAddress.Parse("9C:AE:D3:74:83:D9");
            BluetoothEndPoint endPoint = new BluetoothEndPoint(address,mUUID);
            client.Connect(endPoint);
            updateUI("connect with success");
            connect = true;
}
aishine 回答:我的UUID适用于智能手机Samsung j5,但不适用于我的Moverio BT-350。为什么?

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3143575.html

大家都在问