简体   繁体   English

通过USB在WinCE设备和Windows PC之间进行通信

[英]Communication between WinCE device and Windows PC over USB

I wrote a simple WinCE application in C++ that performs basic tasks like saves notes, sets reminders, and turns on/off my device's LED. 我用C ++编写了一个简单的WinCE应用程序,该应用程序执行一些基本任务,例如保存注释,设置提醒以及打开/关闭设备的LED。 To get more familiar with programming, I now want to transfer over USB and print to a command prompt on my PC some of this data. 为了更加熟悉编程,我现在想通过USB传输并将其中的一些数据打印到PC上的命令提示符。 Any information (reading material, videos, libraries I should look into, etc.)? 有什么信息(阅读我应该研究的资料,视频,图书馆等)?

This is an incredibly broad question and I think the answer depends entirely on what kind of programming you are looking to gain familiarity with, your level of experience, and the amount of time you are willing to put in. 这是一个令人难以置信的广泛问题,我认为答案完全取决于您想熟悉哪种编程,您的经验水平以及您愿意投入的时间。

That said, I would recommend one of the following three approaches, in increasing levels of difficulty: 话虽如此,我还是建议以下三种方法之一,以增加难度:

  1. If your WinCE device supports ActiveSync and the PC runs Windows, use Microsoft RAPI . 如果您的WinCE设备支持ActiveSync,并且PC运行Windows,请使用Microsoft RAPI With RAPI, you can write PC software to perform a number of remote file- and registry operations on your WinCE device. 使用RAPI,您可以编写PC软件来在WinCE设备上执行许多远程文件和注册表操作。 RAPI also supports a generic, ioctl-style RapiInvoke function, which allows you to call into your own custom dll's on the device, and set up a communication stream between the device and PC. RAPI还支持通用的,ioctl风格的RapiInvoke函数,该函数允许您在设备上调用自己的自定义dll,并在设备和PC之间建立通信流。
  2. Alternatively, if your WinCE device and PC support Remote NDIS , you can use sockets to communicate with the device, exchange information etc. This is really no different from using sockets over any IP-based network, and the experience gained would be more generally applicable than a RAPI-based implementation. 另外,如果您的WinCE设备和PC支持远程NDIS ,则可以使用套接字与设备进行通信,交换信息等。这与在任何基于IP的网络上使用套接字没有什么不同,并且所获得的经验将更适用。而不是基于RAPI的实现。 Most Windows PC's either support RNDIS or drivers are available for download, but, to my knowledge, few WinCE devices do, at least out of the box. 大多数Windows PC都支持RNDIS或驱动程序可供下载,但是据我所知,至少很少有WinCE设备可以使用。
  3. Finally, there's the DIY solution - implement custom USB drivers for the PC and WinCE device yourself. 最后,还有DIY解决方案-自己为PC和WinCE设备实现自定义USB驱动程序。 This doesn't have to be as scary as it might sound. 这不必像听起来那样可怕。 Microsoft Platform Builder comes with sample code that allows you to fairly quickly get a simple, stream-based driver off the ground, and various device driver kits exist for PC's that free you from writing any kernel-mode code at all. Microsoft Platform Builder附带了示例代码,使您可以相当迅速地获得一个简单的,基于流的驱动程序,并且PC的各种设备驱动程序工具包使您完全不必编写任何内核模式代码。

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

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