这适用于所有了解使用32feet.net / InTheHand的蓝牙编程来龙去脉的人
我使用32feet.net 3.5.0.3的InTheHand.Net.Personal.dll
在vb.net 2008的PC上使用Windows 8进行编码我的目标:通过蓝牙将我的电脑连接到我的三星Galaxy S6 Android 6.0.1(Marshmallow)并将文件复制到手机上。
这就是我编码的原因:
(...)
Imports InTheHand.Net
Private Sub demo()
Dim peer As Sockets.BluetoothDeviceInfo
Dim req As ObexWebRequest
For Each peer In New Sockets.BluetoothClient().DiscoverDevices()
If peer.DeviceName = "MyGalaxyPhone" Then
req = New ObexWebRequest _
(peer.DeviceAddress, _
"obex://c:/users/admin/documents")
req.ReadFile("c:\users\admin\documents\test.txt")
req.GetResponse()
Exit For
End If
Next
End Sub
(...)
在req.GetResponse
我收到一个异常,说System.Net.WebException {Connect failed}
当我尝试使用peer.InstalledServices
获取支持的服务时,我获得1105,但不是1106,这似乎是OBEX所必需的。 1105是OPP,正如我从文档中理解的那样。但是,我不知道如何调用任何OPP函数。
任何帮助表示感谢。
由于
S上。罗伊
答案 0 :(得分:0)
我显然不知道自己在做什么。 在上面的代码中,我写道:
req = New ObexWebRequest _
(peer.DeviceAddress, _
"obex://c:/users/admin/documents")
这不起作用。 它应该说:
req = New ObexWebRequest _
(peer.DeviceAddress, _
"obex://" + peer.DeviceAddress.ToString + "/test.txt")
这很有效。
此致