Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/268.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/192.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 我的UUID适用于智能手机三星j5,但不适用于我的Moverio BT-350。为什么?_C#_Android_Unity3d_Bluetooth_Uuid - Fatal编程技术网

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

C# 我的UUID适用于智能手机三星j5,但不适用于我的Moverio BT-350。为什么?,c#,android,unity3d,bluetooth,uuid,C#,Android,Unity3d,Bluetooth,Uuid,使用Unity(因此使用C#),我制作了一个Android手机应用程序,通过蓝牙与PC windows进行通信。问题是,当我在智能手机三星j5上运行apk时,一切都很好,当我在另一部手机或Moverio BT-350(总是Android)上运行相同的apk时,我无法建立蓝牙连接,并且出现错误。显然,当我从一个设备切换到另一个设备时,我会更改设备的蓝牙MAC地址。我没有改变的是UUID。事实上,我认为UUID是问题所在。但我该如何改变它呢?如何分配有效的UUID 如果我试图用Visual Stud

使用Unity(因此使用C#),我制作了一个Android手机应用程序,通过蓝牙与PC windows进行通信。问题是,当我在智能手机三星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;
}
使用系统;
使用System.Collections.Generic;
使用System.Linq;
使用系统文本;
使用System.Windows.Forms;
使用系统线程;
使用inthand.Net.Bluetooth;
使用inthand.Net.Sockets;
使用inthand.Net;
使用System.IO;
命名空间BluetoothForWindows
{ 
公共部分类Form1:Form
{
//这是UUID,我对J5没有问题,但我对Moverio有问题
Guid mUUID=新Guid(“c1db6770-a359-11e6-80f5-76304dec7eb7”);
布尔连接=假;
蓝牙客户端;
公共表格1()
{
项目=新列表();
初始化组件();
}
私有无效bGo_单击(对象发送方,事件参数e)
{
client=新的BluetoothClient();
更新(“尝试连接”);
//当我设置J5的MAC地址时,就是14:9F:3C:92:12:06,
//我没有问题,当我设置Moverio的MAC地址时,就是9C:AE:D3:74:83:D9,
//我有一个连接失败的错误
蓝牙地址=
解析(“9C:AE:D3:74:83:D9”);
BluetoothEndPoint=新的BluetoothEndPoint(地址,mUUID);
client.Connect(端点);
updateUI(“与成功联系”);
connect=true;
}

UUID的要点是唯一性。如果将此应用程序发布到多个设备,它将不再是唯一的。以及如何创建适用于Moverio和其他设备的新UUID??感谢您的回复,但我仍然没有解决问题。当我尝试在Moverio上从Windows PC连接到Android应用程序时,在Android应用程序上应用程序继续正常运行,但在Windows上停止时会显示以下错误消息(以意大利语报告):System.Net.Sockets.SocketException:“Indirizzo richiesto非有效的nel proprio竞赛9CAED37483D9:cfb771803d214018ad4ab48855bef91a”(尤其是UUID的值每次都会更改)那就不知道了。我没有弄乱蓝牙。UUID的要点是唯一的。如果你将此应用发布到多个设备,它就不再是唯一的。以及如何创建适用于Moverio和其他设备的新UUID??谢谢你的回复,但我仍然没有解决问题。当我尝试在上从Windows PC连接到Android应用时Moverio在Android上,应用程序继续正常运行,而在Windows上,应用程序停止运行时出现以下错误消息(以意大利语报告):System.Net.Sockets.SocketException:“Indirizzo richiesto non valido nel proprio Competito 9CAED37483D9:cfb771803d214018ad4ab48855bef91a”(尤其是UUID的值每次都会发生变化)那就不知道了。我没弄乱蓝牙。