通过 USB 与 PC 通信 [英] Communicate to PC over USB

查看:77
本文介绍了通过 USB 与 PC 通信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在我的 WP8 应用程序和我的桌面 Windows 应用程序之间交换数据,该应用程序通过 USB 线连接了手机?在 WP7 上,有通过 USB 连接的 TCP/IP 网络.在 WP8 上,它似乎不再有效.

How can I exchange data between my WP8 app and my desktop Windows app running on the PC that has the phone connected with a USB cable? On WP7, there was TCP/IP networking over USB connection. On WP8, it seems it no longer works.

在设备端,NetworkInterfaceList 类列出了以太网适配器,但是 NetworkInformation.GetHostNames 方法表示没有分配给该 NIC 的 IP 地址.有没有办法为该 NIC 分配 IP 地址,并将其用于通过 USB 电缆进行电话到 PC 的通信?

On the device side, NetworkInterfaceList class lists the Ethernet adapter, however NetworkInformation.GetHostNames method says there is no IP address assigned to that NIC. Is there a way to assign an IP address to that NIC, and use it for phone-to-pc communication over the USB cable?

在 PC 端,看起来连接 DLL 实现了智能设备连接 API.在哪里可以找到适用于 Windows Phone 8 平台的 Microsoft.Smartdevice.DeviceAgentTransport.dll?

On the PC side, looks like the connectivity DLLs implement Smart Device Connectivity API. Where can I find Microsoft.Smartdevice.DeviceAgentTransport.dll for Windows Phone 8 platform?

还有其他选择吗?

附言我没有向市场提交任何内容,因此私有或未记录的 API 对我来说是可以的.

P.S. I am not submitting anything to the marketplace, so private or undocumented APIs are OK for me.

推荐答案

我只是自己在寻找这个,并在 msdn 上找到了一个很好的资源,IP over USB.只要您安装了 Windows Phone SDK,您就拥有了一切.

I was just looking for this one myself and found a good resource over at msdn, IP over USB. As long as you have the windows phone SDK installed you have everything.

一个小更新,似乎服务器代码必须在设备上运行,客户端在主机上运行,​​但除此之外,一切都按预期工作.

A small update, it seems that the server code must be running on the device and the client on the host, but apart from that everything worked as expected.

  • 使用 regedit 在 HKEY_LOCAL_MACHINE\Software\Microsoft\IpOverUsbSDK 下添加新条目并创建与其他条目类似的值,只是端口不同.
  • IpOverUsbEnum.exe 用了几秒钟并刷新了 regedit 以显示新服务.
  • Used regedit to add a new entry under HKEY_LOCAL_MACHINE\Software\Microsoft\IpOverUsbSDK and created values similar to other entries, just different ports.
  • It took a few seconds and a refresh of regedit for IpOverUsbEnum.exe to display the new service.

这篇关于通过 USB 与 PC 通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆