简体   繁体   中英

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.

I am using 32feet by alanjmcf - Thanks for providing this wonderful 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.

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,

but my Samsung will ask my confirmation for each file, which is not manageable.

What can I do?

Thanks and regards S. Roy

Do you mean by "confirmation" is that your Samsung mobile requests pairing by showing a PIN number? If so, then you need to stop the pairing request to be sent to clients from the VB.NET server. I think you can do that by setting the AuthenticationLevel in your request.

For a BluetoothClient instance, I usually set the Authenticate property to false to stop request for pairing.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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