我正在编写一台蓝牙扫描仪,用于定位和识别本地附近的移动设备。这是我可以使用C#完成的事情,还是我需要深入了解C / C ++ API?我的应用程序针对Windows XP和Vista。指针很受欢迎。

谢谢!

有帮助吗?

解决方案

PC上蓝牙的一个问题是,有几个BT堆正在使用中,你永远不知道在给定的机器上哪个可用。最常见的是Widcomm(现在是Broadcom)和Microsoft(出现在XP中,可能是其中一个服务包)。但是,一些BT硬件供应商打包BlueSoleil,有些则使用东芝。大多数加密狗都可以使用MS堆栈,因此我见过的.NET库倾向于使用它。

每个堆栈都有完全不同的方式来执行发现部分,您可以在其中浏览附近的设备并查询其服务。

如果我今天必须选择一种方法,我可能会在C ++中进行发现,并为.NET添加一个接口。

32feet.net的东西在我尝试时效果很好,但不支持Widcomm堆栈。

其他提示

还有Peter Foot的32feet.net

http://inthehand.com/content/32feet.aspx

当它是v1.5并且运行良好时,我已经玩过它了。

Mike Petrichenko 有一个不错的BT框架。它适用于BlueSoleil,Widcomm,Toshiba和Microsoft。

现在称为无线通信库,可与蓝牙802.11和红外线配合使用。 Mike将该公司命名为Soft Service Company公司,销售非商业和商业许可证,有或没有源代码,价格在100美元到2050美元之间。

了解蓝牙设备并从PC向蓝牙设备发送文件的最佳方法是使用该代码。

    public void ExecuteCommandSync(object command)
    {
        try
        {
            // create the ProcessStartInfo using "cmd" as the program to be run,
            // and "/c " as the parameters.
            // Incidentally, /c tells cmd that we want it to execute the command that follows,
            // and then exit.
            System.Diagnostics.ProcessStartInfo procStartInfo =
                new System.Diagnostics.ProcessStartInfo("cmd", "/c " + command);

            // The following commands are needed to redirect the standard output.
            // This means that it will be redirected to the Process.StandardOutput StreamReader.
            procStartInfo.RedirectStandardOutput = true;
            procStartInfo.UseShellExecute = false;
            // Do not create the black window.
            procStartInfo.CreateNoWindow = true;

            // Now we create a process, assign its ProcessStartInfo and start it
            System.Diagnostics.Process proc = new System.Diagnostics.Process();
            proc.StartInfo = procStartInfo;
            proc.Start();

            // Get the output into a string
            string result = proc.StandardOutput.ReadToEnd();
            // Display the command output.
            Console.WriteLine(result);
        }
        catch (Exception objException)
        {
            // Log the exception
            MessageBox.Show(objException.Message);
        }
    }

您可以将此方法称为

                          string command = "fsquirt";
                          ExecuteCommandSync(command);

因此,出现BluetoothFileTransferWizard,您可以选择可用设备并发送文件以发送该设备。如果您不想使用这种方式,请尝试32feet.net.uk。这对于C#和VB.NET的蓝牙开发非常有用。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top