简体   繁体   English

如何通过蓝牙OBEX和32feet复制多个文件?

[英]How can I copy multiple files via Bluetooth OBEX and 32feet?

What I want to achieve: Write a VB.NET program that grabs a folder structure on my Windows 8 and copies the structure to a base directory on my Samsung Galaxy S6 via Bluetooth. 我要实现的目标:编写一个VB.NET程序,该程序可以在Windows 8上获取文件夹结构,然后通过蓝牙将结构复制到Samsung Galaxy S6的基本目录中。

I am using 32feet by alanjmcf - Thanks for providing this wonderful api. 我正在使用alanjmcf编写的32feet-感谢您提供此精彩的api。

What I have managed so far: I wrote a VB.NET 32feet application that successfully copies 1 file from Windows to my Samsung Galaxy S6. 到目前为止,我所管理的是:我编写了一个VB.NET 32feet应用程序,该应用程序已成功将1个文件从Windows复制到我的Samsung Galaxy S6。

The code extract: 代码摘录:

    Public Sub demo()
       Dim peer As Sockets.BluetoothDeviceInfo
       Dim req As ObexWebRequest

       For Each peer In New Sockets.BluetoothClient().DiscoverDevices()
           If peer.DeviceName = "Galaxy S6" Then
               req = New ObexWebRequest _
                    (peer.DeviceAddress, _
                     "obex://" + peer.DeviceAddress.ToString + "/" + "test.txt")
               req.ReadFile("c:\users\admin\documents\test.txt")
               req.GetResponse()
               Exit For
           End If
       Next
    End Sub

My Samsung mobile asks a confirmation. 我的三星手机要求确认。 Upon my "Go" it receives the file. 根据我的“开始”,它接收文件。

I would like to copy multiple files from a folder structure instead. 我想从文件夹结构中复制多个文件。 And put them into an analogous folder structure in my Samsung mobile. 并将它们放入我的三星手机中的类似文件夹结构中。

I could of course iterate through my files and repeat the block above, possibly specifying folders in the URI, 我当然可以遍历我的文件并重复上述步骤,可能在URI中指定文件夹,

but my Samsung will ask my confirmation for each file, which is not manageable. 但是我的三星会要求我对每个文件进行确认,这是无法管理的。

What can I do? 我能做什么?

Thanks and regards S. Roy 谢谢和问候S.罗伊

Do you mean by "confirmation" is that your Samsung mobile requests pairing by showing a PIN number? 您所说的“确认”是指您的三星手机通过显示PIN码来请求配对吗? If so, then you need to stop the pairing request to be sent to clients from the VB.NET server. 如果是这样,则您需要停止从VB.NET服务器发送给客户端的配对请求。 I think you can do that by setting the AuthenticationLevel in your request. 我认为您可以通过在请求中设置AuthenticationLevel来实现。

For a BluetoothClient instance, I usually set the Authenticate property to false to stop request for pairing. 对于BluetoothClient实例,我通常将Authenticate属性设置为false以停止配对请求。

One more thing, when working with OBEX, I prefer to stop the OBEX Windows service from the services console, so it cannot interfere the Bluetooth communication. 还有一件事,当使用OBEX时,我更喜欢从服务控制台中停止OBEX Windows服务,因此它不会干扰蓝牙通信。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM